]> granicus.if.org Git - clang/commitdiff
[ASTImporter] Fix up test that only works on X86.
authorDavid Green <david.green@arm.com>
Sat, 2 Feb 2019 08:31:22 +0000 (08:31 +0000)
committerDavid Green <david.green@arm.com>
Sat, 2 Feb 2019 08:31:22 +0000 (08:31 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352956 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/AST/StructuralEquivalenceTest.cpp

index e6c289a5f6529f60f47ea42224e799da60c038d8..ae62747284108ddb5116b82e1baad678b4ca8e67 100644 (file)
@@ -378,10 +378,12 @@ TEST_F(StructuralEquivalenceFunctionTest, FunctionsWithDifferentNoreturnAttr) {
   EXPECT_TRUE(testStructuralMatch(t));
 }
 
-// These attributes may not be available on certain platforms.
-#if defined(__x86_64__) && defined(__linux__)
 TEST_F(StructuralEquivalenceFunctionTest,
     FunctionsWithDifferentCallingConventions) {
+  // These attributes may not be available on certain platforms.
+  if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).getArch() !=
+      llvm::Triple::x86_64)
+    return;
   auto t = makeNamedDecls(
       "__attribute__((preserve_all)) void foo();",
       "__attribute__((ms_abi))   void foo();",
@@ -390,13 +392,15 @@ TEST_F(StructuralEquivalenceFunctionTest,
 }
 
 TEST_F(StructuralEquivalenceFunctionTest, FunctionsWithDifferentSavedRegsAttr) {
+  if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).getArch() !=
+      llvm::Triple::x86_64)
+    return;
   auto t = makeNamedDecls(
       "__attribute__((no_caller_saved_registers)) void foo();",
       "                                           void foo();",
       Lang_C);
   EXPECT_FALSE(testStructuralMatch(t));
 }
-#endif
 
 struct StructuralEquivalenceCXXMethodTest : StructuralEquivalenceTest {
 };