[PATCH] Improve diagnostic message for misplaced square brackets
Richard Smith
richard at metafoo.co.uk
Tue May 6 18:45:25 PDT 2014
================
Comment at: lib/Parse/ParseDecl.cpp:4841
@@ -4824,3 +4840,3 @@
// portion is empty), if an abstract-declarator is allowed.
D.SetIdentifier(0, Tok.getLocation());
----------------
This looks like it'll provide the wrong location if there were misplaced brackets.
================
Comment at: lib/Parse/ParseDecl.cpp:4862
@@ -4838,3 +4861,3 @@
: D.getDeclSpec().getSourceRange());
- else if (getLangOpts().CPlusPlus) {
- if (Tok.is(tok::period) || Tok.is(tok::arrow))
+ } else if (getLangOpts().CPlusPlus) {
+ if (!UnhandledError && (Tok.is(tok::period) || Tok.is(tok::arrow)))
----------------
Have you considered putting the bracket parsing code way down here (and recursively calling back into this function after parsing them)?
http://reviews.llvm.org/D2712
More information about the cfe-commits
mailing list