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

Peter Collingbourne peter at pcc.me.uk
Fri Apr 4 16:27:43 PDT 2014



================
Comment at: lib/ASTMatchers/Dynamic/Parser.cpp:304
@@ +303,3 @@
+
+  // Parse as a matcher expressoin.
+  return parseMatcherExpressionImpl(NameToken, Value);
----------------
Typo: "expression".

================
Comment at: lib/ASTMatchers/Dynamic/Registry.cpp:334
@@ -333,2 +333,3 @@
   if (it == RegistryData->constructors().end()) {
-    Error->addError(NameRange, Error->ET_RegistryNotFound) << MatcherName;
+    if (Error) {
+      Error->addError(NameRange, Error->ET_RegistryMatcherNotFound)
----------------
I wonder if it would be better to drop the Error parameter from this function (and Sema::lookupMatcherCtor) and move diagnostic emission to the parser. That would be more consistent with how Sema::getNamedValue works, and would also allow you to do both lookups once, in parseIdentifierPrefixImpl.


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



More information about the cfe-commits mailing list