On 07/08/2013 10:48 AM, Enea Zaffanella wrote:
On 07/08/2013 08:59 AM, NAKAMURA Takumi wrote:
Enea,

It was incompatible to ms mode. I made it suppressed partially in
r185795.

clang\unittests\AST\SourceLocationTest.cpp(222):
error: Value of: Verifier.match( "template <typename U>\n" "U foo()
{\n" "  return U{};\n" "}", unresolvedConstructExpr(), Lang_CXX11)
   Actual: false (Could not find match)
Expected: true
[  FAILED  ] CXXUnresolvedConstructExpr.SourceRange (4 ms)

Do you think it'd be better to add "-fno-delayed-template-parsing" there?

[...]

Or maybe add an overloaded version with such an additional parameter?

Would the attached patch be OK?
(Note: made no test at all on windows).

Enea.
Index: unittests/AST/SourceLocationTest.cpp
===================================================================
--- unittests/AST/SourceLocationTest.cpp	(revision 185798)
+++ unittests/AST/SourceLocationTest.cpp	(working copy)
@@ -211,21 +211,18 @@
       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
Index: unittests/AST/MatchVerifier.h
===================================================================
--- unittests/AST/MatchVerifier.h	(revision 185798)
+++ unittests/AST/MatchVerifier.h	(working copy)
@@ -34,13 +34,24 @@
   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);
   virtual void verify(const MatchFinder::MatchResult &Result,
@@ -64,13 +75,13 @@
 /// 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:
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to