r185827 - Fixed testcase failing under MS by adding "-fno-delayed-template-parsing",

Enea Zaffanella zaffanella at cs.unipr.it
Mon Jul 8 07:50:30 PDT 2013


Author: enea
Date: Mon Jul  8 09:50:30 2013
New Revision: 185827

URL: http://llvm.org/viewvc/llvm-project?rev=185827&view=rev
Log:
Fixed testcase failing under MS by adding "-fno-delayed-template-parsing",
as suggested by Takumi. To this end, added a MatchVerifier::match()
overload accepting a vector of invocation arguments.


Modified:
    cfe/trunk/unittests/AST/MatchVerifier.h
    cfe/trunk/unittests/AST/SourceLocationTest.cpp

Modified: cfe/trunk/unittests/AST/MatchVerifier.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/MatchVerifier.h?rev=185827&r1=185826&r2=185827&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/MatchVerifier.h (original)
+++ cfe/trunk/unittests/AST/MatchVerifier.h Mon Jul  8 09:50:30 2013
@@ -34,12 +34,23 @@ public:
   template <typename MatcherType>
   testing::AssertionResult match(const std::string &Code,
                                  const MatcherType &AMatcher) {
-    return match(Code, AMatcher, Lang_CXX);
+    std::vector<std::string> Args;
+    return match(Code, AMatcher, Args, Lang_CXX);
   }
 
   template <typename MatcherType>
   testing::AssertionResult match(const std::string &Code,
-                                 const MatcherType &AMatcher, Language L);
+                                 const MatcherType &AMatcher,
+                                 Language L) {
+    std::vector<std::string> Args;
+    return match(Code, AMatcher, Args, L);
+  }
+
+  template <typename MatcherType>
+  testing::AssertionResult match(const std::string &Code,
+                                 const MatcherType &AMatcher,
+                                 std::vector<std::string>& Args,
+                                 Language L);
 
 protected:
   virtual void run(const MatchFinder::MatchResult &Result);
@@ -64,13 +75,13 @@ private:
 /// verifier for the matched node.
 template <typename NodeType> template <typename MatcherType>
 testing::AssertionResult MatchVerifier<NodeType>::match(
-    const std::string &Code, const MatcherType &AMatcher, Language L) {
+    const std::string &Code, const MatcherType &AMatcher,
+    std::vector<std::string>& Args, Language L) {
   MatchFinder Finder;
   Finder.addMatcher(AMatcher.bind(""), this);
   OwningPtr<tooling::FrontendActionFactory> Factory(
       tooling::newFrontendActionFactory(&Finder));
 
-  std::vector<std::string> Args;
   StringRef FileName;
   switch (L) {
   case Lang_C:

Modified: cfe/trunk/unittests/AST/SourceLocationTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/SourceLocationTest.cpp?rev=185827&r1=185826&r2=185827&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/SourceLocationTest.cpp (original)
+++ cfe/trunk/unittests/AST/SourceLocationTest.cpp Mon Jul  8 09:50:30 2013
@@ -211,21 +211,18 @@ TEST(CXXFunctionalCastExpr, SourceRange)
       functionalCastExpr(), Lang_CXX11));
 }
 
-#if !defined(_MSC_VER)
-// FIXME: It could pass if MS-compatible mode were disabled.
-// Args.push_back("-fno-delayed-template-parsing");
-
 TEST(CXXUnresolvedConstructExpr, SourceRange) {
   RangeVerifier<CXXUnresolvedConstructExpr> Verifier;
   Verifier.expectRange(3, 10, 3, 12);
+  std::vector<std::string> Args;
+  Args.push_back("-fno-delayed-template-parsing");
   EXPECT_TRUE(Verifier.match(
       "template <typename U>\n"
       "U foo() {\n"
       "  return U{};\n"
       "}",
-      unresolvedConstructExpr(), Lang_CXX11));
+      unresolvedConstructExpr(), Args, Lang_CXX11));
 }
-#endif
 
 } // end namespace ast_matchers
 } // end namespace clang





More information about the cfe-commits mailing list