This is an archive of the discontinued LLVM Phabricator instance.

Add support for named values in the parser.
ClosedPublic

Authored by sbenza on Apr 3 2014, 6:00 AM.

Details

Reviewers
pcc
Summary

Add support for named values in the parser.

Diff Detail

Event Timeline

sbenza added a comment.Apr 3 2014, 6:02 AM

I rolled back the premature cl and sent it again.
Please review on this thread instead.

sbenza updated this revision to Unknown Object (????).Apr 4 2014, 1:55 PM

Added "Value not found" error.
Added explicit conversion to bool on VariantValue. Replaced isNothing() with hasValue().

sbenza added a comment.Apr 4 2014, 2:00 PM

Added the check you asked for. It will say "Value not found" only when it think you really meant a to use a value.

pcc added inline comments.Apr 4 2014, 4:27 PM
lib/ASTMatchers/Dynamic/Parser.cpp
308

Typo: "expression".

lib/ASTMatchers/Dynamic/Registry.cpp
330–331

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.

sbenza updated this revision to Unknown Object (????).Apr 7 2014, 8:40 AM

Move error handling into the parser.

sbenza added inline comments.Apr 7 2014, 8:41 AM
lib/ASTMatchers/Dynamic/Parser.cpp
308

Fixed.

lib/ASTMatchers/Dynamic/Registry.cpp
330–331

Yes. It made sense when it was inside constructMatcher, but now it makes more sense outside.

pcc accepted this revision.Apr 16 2014, 5:42 PM

Was committed in r206176.

pcc closed this revision.Apr 16 2014, 5:42 PM