forked from OSchip/llvm-project
[llvm] Wrap multi-statement macro definitions with do ... while (0)
This commit is contained in:
parent
3a6b766b1b
commit
cd434a202c
|
@ -51,44 +51,48 @@ static cl::opt<std::string>
|
|||
cl::cat(LLVMReduceOptions));
|
||||
|
||||
#define DELTA_PASSES \
|
||||
DELTA_PASS("special-globals", reduceSpecialGlobalsDeltaPass) \
|
||||
DELTA_PASS("aliases", reduceAliasesDeltaPass) \
|
||||
DELTA_PASS("function-bodies", reduceFunctionBodiesDeltaPass) \
|
||||
DELTA_PASS("functions", reduceFunctionsDeltaPass) \
|
||||
DELTA_PASS("basic-blocks", reduceBasicBlocksDeltaPass) \
|
||||
DELTA_PASS("global-values", reduceGlobalValuesDeltaPass) \
|
||||
DELTA_PASS("global-objects", reduceGlobalObjectsDeltaPass) \
|
||||
DELTA_PASS("global-initializers", reduceGlobalsInitializersDeltaPass) \
|
||||
DELTA_PASS("global-variables", reduceGlobalsDeltaPass) \
|
||||
DELTA_PASS("metadata", reduceMetadataDeltaPass) \
|
||||
DELTA_PASS("arguments", reduceArgumentsDeltaPass) \
|
||||
DELTA_PASS("instructions", reduceInstructionsDeltaPass) \
|
||||
DELTA_PASS("simplify-instructions", simplifyInstructionsDeltaPass) \
|
||||
DELTA_PASS("operands-zero", reduceOperandsZeroDeltaPass) \
|
||||
DELTA_PASS("operands-one", reduceOperandsOneDeltaPass) \
|
||||
DELTA_PASS("operands-nan", reduceOperandsNaNDeltaPass) \
|
||||
DELTA_PASS("operands-to-args", reduceOperandsToArgsDeltaPass) \
|
||||
DELTA_PASS("operands-skip", reduceOperandsSkipDeltaPass) \
|
||||
DELTA_PASS("operand-bundles", reduceOperandBundesDeltaPass) \
|
||||
DELTA_PASS("attributes", reduceAttributesDeltaPass) \
|
||||
DELTA_PASS("module-data", reduceModuleDataDeltaPass)
|
||||
do { \
|
||||
DELTA_PASS("special-globals", reduceSpecialGlobalsDeltaPass) \
|
||||
DELTA_PASS("aliases", reduceAliasesDeltaPass) \
|
||||
DELTA_PASS("function-bodies", reduceFunctionBodiesDeltaPass) \
|
||||
DELTA_PASS("functions", reduceFunctionsDeltaPass) \
|
||||
DELTA_PASS("basic-blocks", reduceBasicBlocksDeltaPass) \
|
||||
DELTA_PASS("global-values", reduceGlobalValuesDeltaPass) \
|
||||
DELTA_PASS("global-objects", reduceGlobalObjectsDeltaPass) \
|
||||
DELTA_PASS("global-initializers", reduceGlobalsInitializersDeltaPass) \
|
||||
DELTA_PASS("global-variables", reduceGlobalsDeltaPass) \
|
||||
DELTA_PASS("metadata", reduceMetadataDeltaPass) \
|
||||
DELTA_PASS("arguments", reduceArgumentsDeltaPass) \
|
||||
DELTA_PASS("instructions", reduceInstructionsDeltaPass) \
|
||||
DELTA_PASS("simplify-instructions", simplifyInstructionsDeltaPass) \
|
||||
DELTA_PASS("operands-zero", reduceOperandsZeroDeltaPass) \
|
||||
DELTA_PASS("operands-one", reduceOperandsOneDeltaPass) \
|
||||
DELTA_PASS("operands-nan", reduceOperandsNaNDeltaPass) \
|
||||
DELTA_PASS("operands-to-args", reduceOperandsToArgsDeltaPass) \
|
||||
DELTA_PASS("operands-skip", reduceOperandsSkipDeltaPass) \
|
||||
DELTA_PASS("operand-bundles", reduceOperandBundesDeltaPass) \
|
||||
DELTA_PASS("attributes", reduceAttributesDeltaPass) \
|
||||
DELTA_PASS("module-data", reduceModuleDataDeltaPass) \
|
||||
} while (false)
|
||||
|
||||
#define DELTA_PASSES_MIR \
|
||||
DELTA_PASS("instructions", reduceInstructionsMIRDeltaPass) \
|
||||
DELTA_PASS("ir-instruction-references", \
|
||||
reduceIRInstructionReferencesDeltaPass) \
|
||||
DELTA_PASS("ir-block-references", reduceIRBlockReferencesDeltaPass) \
|
||||
DELTA_PASS("ir-function-references", reduceIRFunctionReferencesDeltaPass) \
|
||||
DELTA_PASS("instruction-flags", reduceInstructionFlagsMIRDeltaPass) \
|
||||
DELTA_PASS("register-uses", reduceRegisterUsesMIRDeltaPass) \
|
||||
DELTA_PASS("register-hints", reduceVirtualRegisterHintsDeltaPass)
|
||||
do { \
|
||||
DELTA_PASS("instructions", reduceInstructionsMIRDeltaPass) \
|
||||
DELTA_PASS("ir-instruction-references", \
|
||||
reduceIRInstructionReferencesDeltaPass) \
|
||||
DELTA_PASS("ir-block-references", reduceIRBlockReferencesDeltaPass) \
|
||||
DELTA_PASS("ir-function-references", reduceIRFunctionReferencesDeltaPass) \
|
||||
DELTA_PASS("instruction-flags", reduceInstructionFlagsMIRDeltaPass) \
|
||||
DELTA_PASS("register-uses", reduceRegisterUsesMIRDeltaPass) \
|
||||
DELTA_PASS("register-hints", reduceVirtualRegisterHintsDeltaPass) \
|
||||
} while (false)
|
||||
|
||||
static void runAllDeltaPasses(TestRunner &Tester) {
|
||||
#define DELTA_PASS(NAME, FUNC) FUNC(Tester);
|
||||
if (Tester.getProgram().isMIR()) {
|
||||
DELTA_PASSES_MIR
|
||||
DELTA_PASSES_MIR;
|
||||
} else {
|
||||
DELTA_PASSES
|
||||
DELTA_PASSES;
|
||||
}
|
||||
#undef DELTA_PASS
|
||||
}
|
||||
|
@ -100,9 +104,9 @@ static void runDeltaPassName(TestRunner &Tester, StringRef PassName) {
|
|||
return; \
|
||||
}
|
||||
if (Tester.getProgram().isMIR()) {
|
||||
DELTA_PASSES_MIR
|
||||
DELTA_PASSES_MIR;
|
||||
} else {
|
||||
DELTA_PASSES
|
||||
DELTA_PASSES;
|
||||
}
|
||||
#undef DELTA_PASS
|
||||
errs() << "unknown pass \"" << PassName << "\"\n";
|
||||
|
@ -113,9 +117,9 @@ void llvm::printDeltaPasses(raw_ostream &OS) {
|
|||
OS << "Delta passes (pass to `--delta-passes=` as a comma separated list):\n";
|
||||
#define DELTA_PASS(NAME, FUNC) OS << " " << NAME << "\n";
|
||||
OS << " IR:\n";
|
||||
DELTA_PASSES
|
||||
DELTA_PASSES;
|
||||
OS << " MIR:\n";
|
||||
DELTA_PASSES_MIR
|
||||
DELTA_PASSES_MIR;
|
||||
#undef DELTA_PASS
|
||||
}
|
||||
|
||||
|
|
|
@ -16,18 +16,22 @@ using namespace llvm;
|
|||
namespace {
|
||||
|
||||
#define EXPECT_VTY_EQ(LHS, RHS) \
|
||||
ASSERT_NE(LHS, nullptr) << #LHS << " must not be null"; \
|
||||
ASSERT_NE(RHS, nullptr) << #RHS << " must not be null"; \
|
||||
EXPECT_EQ(LHS, RHS) << "Expect that " << #LHS << " == " << #RHS << " where " \
|
||||
<< #LHS << " = " << *LHS << " and " << #RHS << " = " \
|
||||
<< *RHS;
|
||||
do { \
|
||||
ASSERT_NE(LHS, nullptr) << #LHS << " must not be null"; \
|
||||
ASSERT_NE(RHS, nullptr) << #RHS << " must not be null"; \
|
||||
EXPECT_EQ(LHS, RHS) << "Expect that " << #LHS << " == " << #RHS \
|
||||
<< " where " << #LHS << " = " << *LHS << " and " \
|
||||
<< #RHS << " = " << *RHS; \
|
||||
} while (false)
|
||||
|
||||
#define EXPECT_VTY_NE(LHS, RHS) \
|
||||
ASSERT_NE(LHS, nullptr) << #LHS << " must not be null"; \
|
||||
ASSERT_NE(RHS, nullptr) << #RHS << " must not be null"; \
|
||||
EXPECT_NE(LHS, RHS) << "Expect that " << #LHS << " != " << #RHS << " where " \
|
||||
<< #LHS << " = " << *LHS << " and " << #RHS << " = " \
|
||||
<< *RHS;
|
||||
do { \
|
||||
ASSERT_NE(LHS, nullptr) << #LHS << " must not be null"; \
|
||||
ASSERT_NE(RHS, nullptr) << #RHS << " must not be null"; \
|
||||
EXPECT_NE(LHS, RHS) << "Expect that " << #LHS << " != " << #RHS \
|
||||
<< " where " << #LHS << " = " << *LHS << " and " \
|
||||
<< #RHS << " = " << *RHS; \
|
||||
} while (false)
|
||||
|
||||
TEST(VectorTypesTest, FixedLength) {
|
||||
LLVMContext Ctx;
|
||||
|
|
Loading…
Reference in New Issue