[PATCH] D33623: Make the parser close parens for you on EOF

Matt Kulukundis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 27 12:20:22 PDT 2017


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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33623.100535.patch
Type: text/x-patch
Size: 1043 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170527/66336404/attachment.bin>


More information about the cfe-commits mailing list