r274269 - Fix ASTMatchersNodeTest to work on Windows.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 30 13:29:29 PDT 2016


Author: jlebar
Date: Thu Jun 30 15:29:29 2016
New Revision: 274269

URL: http://llvm.org/viewvc/llvm-project?rev=274269&view=rev
Log:
Fix ASTMatchersNodeTest to work on Windows.

It was failing because it had an explicit check for whether we're on
Windows.

There are a few other similar explicit checks in this file which I
didn't remove because they serve as reasonable documentation that the
test doesn't work with a Windows triple.

Modified:
    cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp?rev=274269&r1=274268&r2=274269&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp Thu Jun 30 15:29:29 2016
@@ -82,13 +82,11 @@ TEST(NameableDeclaration, REMatchesVario
 
 TEST(DeclarationMatcher, MatchClass) {
   DeclarationMatcher ClassMatcher(recordDecl());
-  llvm::Triple Triple(llvm::sys::getDefaultTargetTriple());
-  if (Triple.getOS() != llvm::Triple::Win32 ||
-    Triple.getEnvironment() != llvm::Triple::MSVC)
-    EXPECT_FALSE(matches("", ClassMatcher));
-  else
-    // Matches class type_info.
-    EXPECT_TRUE(matches("", ClassMatcher));
+
+  // This passes on Windows only because we explicitly pass -target
+  // i386-unknown-unknown.  If we were to compile with the default target
+  // triple, we'd want to EXPECT_TRUE if it's Win32 or MSVC.
+  EXPECT_FALSE(matches("", ClassMatcher));
 
   DeclarationMatcher ClassX = recordDecl(recordDecl(hasName("X")));
   EXPECT_TRUE(matches("class X;", ClassX));




More information about the cfe-commits mailing list