fowles created this revision.
Herald added a subscriber: klimek.

Makes the parser for clang-query auto close all open parens on EOF


https://reviews.llvm.org/D33623

Files:
  lib/ASTMatchers/Dynamic/Parser.cpp
  unittests/ASTMatchers/Dynamic/ParserTest.cpp


Index: unittests/ASTMatchers/Dynamic/ParserTest.cpp
===================================================================
--- unittests/ASTMatchers/Dynamic/ParserTest.cpp
+++ unittests/ASTMatchers/Dynamic/ParserTest.cpp
@@ -239,7 +239,6 @@
       ParseWithError("stmt(someValue)"));
   EXPECT_EQ(
       "1:1: Matcher not found: Foo\n"
-      "1:4: Error parsing matcher. Found end-of-code while looking for ')'.",
       ParseWithError("Foo("));
   EXPECT_EQ("1:1: End of code found while looking for token.",
             ParseWithError(""));
Index: lib/ASTMatchers/Dynamic/Parser.cpp
===================================================================
--- lib/ASTMatchers/Dynamic/Parser.cpp
+++ lib/ASTMatchers/Dynamic/Parser.cpp
@@ -377,8 +377,8 @@
   }
 
   if (EndToken.Kind == TokenInfo::TK_Eof) {
-    Error->addError(OpenToken.Range, Error->ET_ParserNoCloseParen);
-    return false;
+    // Just assume they want to finish the expression immediately and did not
+    // have enough trailing right parens.
   }
 
   std::string BindID;


Index: unittests/ASTMatchers/Dynamic/ParserTest.cpp
===================================================================
--- unittests/ASTMatchers/Dynamic/ParserTest.cpp
+++ unittests/ASTMatchers/Dynamic/ParserTest.cpp
@@ -239,7 +239,6 @@
       ParseWithError("stmt(someValue)"));
   EXPECT_EQ(
       "1:1: Matcher not found: Foo\n"
-      "1:4: Error parsing matcher. Found end-of-code while looking for ')'.",
       ParseWithError("Foo("));
   EXPECT_EQ("1:1: End of code found while looking for token.",
             ParseWithError(""));
Index: lib/ASTMatchers/Dynamic/Parser.cpp
===================================================================
--- lib/ASTMatchers/Dynamic/Parser.cpp
+++ lib/ASTMatchers/Dynamic/Parser.cpp
@@ -377,8 +377,8 @@
   }
 
   if (EndToken.Kind == TokenInfo::TK_Eof) {
-    Error->addError(OpenToken.Range, Error->ET_ParserNoCloseParen);
-    return false;
+    // Just assume they want to finish the expression immediately and did not
+    // have enough trailing right parens.
   }
 
   std::string BindID;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to