[PATCH] Introduce Parser::completeExpression.

Peter Collingbourne peter at pcc.me.uk
Thu Jan 23 18:21:25 PST 2014



================
Comment at: lib/ASTMatchers/Dynamic/Parser.cpp:388
@@ +387,3 @@
+  // We cannot complete code if there is an invalid element on the context
+  // stack.
+  for (ContextStackTy::iterator I = ContextStack.begin(),
----------------
Samuel Benzaquen wrote:
> Is there a good use case for not aborting the parse if lookupMatcherCtor() returns null?
> (instead of pushing it into the stack and then checking if there is a null in the stack)
Not aborting gives us better (i.e. more) diagnostics. If we abort early, no diagnostics appear for anything after the invalid matcher name. (This also causes some unit tests under ParserTest.Errors to fail.)

================
Comment at: lib/ASTMatchers/Dynamic/Parser.cpp:294
@@ -262,2 +293,3 @@
             << CommaToken.Text;
+        ContextStack.pop_back();
         return false;
----------------
Samuel Benzaquen wrote:
> Can you add a scoped object that will pop_back automatically?
Done.


http://llvm-reviews.chandlerc.com/D2261



More information about the cfe-commits mailing list