Skip to content

Commit 1be906a

Browse files
committed
[ASTImporter] Fix up test that only works on X86.
The test will fail if the default target triple is not X86, even if the host platform is. So move the check into the test at runtime. llvm-svn: 352956
1 parent d3107a7 commit 1be906a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

clang/unittests/AST/StructuralEquivalenceTest.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,12 @@ TEST_F(StructuralEquivalenceFunctionTest, FunctionsWithDifferentNoreturnAttr) {
378378
EXPECT_TRUE(testStructuralMatch(t));
379379
}
380380

381-
// These attributes may not be available on certain platforms.
382-
#if defined(__x86_64__) && defined(__linux__)
383381
TEST_F(StructuralEquivalenceFunctionTest,
384382
FunctionsWithDifferentCallingConventions) {
383+
// These attributes may not be available on certain platforms.
384+
if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).getArch() !=
385+
llvm::Triple::x86_64)
386+
return;
385387
auto t = makeNamedDecls(
386388
"__attribute__((preserve_all)) void foo();",
387389
"__attribute__((ms_abi)) void foo();",
@@ -390,13 +392,15 @@ TEST_F(StructuralEquivalenceFunctionTest,
390392
}
391393

392394
TEST_F(StructuralEquivalenceFunctionTest, FunctionsWithDifferentSavedRegsAttr) {
395+
if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).getArch() !=
396+
llvm::Triple::x86_64)
397+
return;
393398
auto t = makeNamedDecls(
394399
"__attribute__((no_caller_saved_registers)) void foo();",
395400
" void foo();",
396401
Lang_C);
397402
EXPECT_FALSE(testStructuralMatch(t));
398403
}
399-
#endif
400404

401405
struct StructuralEquivalenceCXXMethodTest : StructuralEquivalenceTest {
402406
};

0 commit comments

Comments
 (0)