[PATCH] Add support for named values in the parser.

Peter Collingbourne peter at pcc.me.uk
Tue Apr 1 18:22:41 PDT 2014



================
Comment at: lib/ASTMatchers/Dynamic/Parser.cpp:431
@@ +430,3 @@
+        S->getNamedValue(Tokenizer->peekNextToken().Text);
+    if (!NamedValue.isNothing()) {
+      Tokenizer->consumeNextToken();  // Actually consume it.
----------------
What if the user defines a named value with the same name as a matcher? Yes, probably a bad idea, but it's easy to disambiguate between a matcher expression and a named value by checking whether the next token is a '('. That would also let us give better diagnostics (i.e. "no such named value" instead of "no such matcher").

It would also be nice (but not required for this change) if it were possible to bind against named values.


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



More information about the cfe-commits mailing list