On Sun, Feb 26, 2012 at 9:36 PM, David Blaikie <[email protected]> wrote:

> On Sun, Feb 26, 2012 at 9:24 PM, Richard Smith
> <[email protected]> wrote:
> > Author: rsmith
> > Date: Sun Feb 26 23:24:00 2012
> > New Revision: 151515
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=151515&view=rev
> > Log:
> > Fix decltype crash-on-invalid, if we don't find a matching ')' for an
> ill-formed
> > decltype expression.
> >
> > Modified:
> >    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
> >    cfe/trunk/test/Parser/bracket-crash.cpp
> >
> > Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=151515&r1=151514&r2=151515&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
> > +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sun Feb 26 23:24:00 2012
> > @@ -674,9 +674,9 @@
> >                                                  0, /*IsDecltype=*/true);
> >     Result = ParseExpression();
> >     if (Result.isInvalid()) {
> > -      SkipUntil(tok::r_paren, true, true);
> > +      SkipUntil(tok::r_paren);
> >       DS.SetTypeSpecError();
> > -      return Tok.is(tok::eof) ? Tok.getLocation() : ConsumeParen();
> > +      return StartLoc;
>
> If I recall correctly this return value is used to get the range of
> the decltype specifier - by returning StartLoc the range of the
> decltype expression will be a bit off. I realize it's an error case
> anyway, so I'm not sure how important that is, just a thought.
>

I considered this, but I'm not too concerned about the source range
covering just the decltype token in the case where the parenthesized
expression is malformed. If we find a case where it causes bad diagnostics
for later errors, we can fix it, but otherwise I don't think there's much
point.

- Richard
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to