<div class="gmail_quote">On Sun, Feb 26, 2012 at 9:36 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Sun, Feb 26, 2012 at 9:24 PM, Richard Smith<br>
<<a href="mailto:richard-llvm@metafoo.co.uk">richard-llvm@metafoo.co.uk</a>> wrote:<br>
> Author: rsmith<br>
> Date: Sun Feb 26 23:24:00 2012<br>
> New Revision: 151515<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=151515&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=151515&view=rev</a><br>
> Log:<br>
> Fix decltype crash-on-invalid, if we don't find a matching ')' for an ill-formed<br>
> decltype expression.<br>
><br>
> Modified:<br>
>    cfe/trunk/lib/Parse/ParseDeclCXX.cpp<br>
>    cfe/trunk/test/Parser/bracket-crash.cpp<br>
><br>
> Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=151515&r1=151514&r2=151515&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=151515&r1=151514&r2=151515&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)<br>
> +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sun Feb 26 23:24:00 2012<br>
> @@ -674,9 +674,9 @@<br>
>                                                  0, /*IsDecltype=*/true);<br>
>     Result = ParseExpression();<br>
>     if (Result.isInvalid()) {<br>
> -      SkipUntil(tok::r_paren, true, true);<br>
> +      SkipUntil(tok::r_paren);<br>
>       DS.SetTypeSpecError();<br>
> -      return Tok.is(tok::eof) ? Tok.getLocation() : ConsumeParen();<br>
> +      return StartLoc;<br>
<br>
</div></div>If I recall correctly this return value is used to get the range of<br>
the decltype specifier - by returning StartLoc the range of the<br>
decltype expression will be a bit off. I realize it's an error case<br>
anyway, so I'm not sure how important that is, just a thought.<br></blockquote><div><br></div><div>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.<br>
<br></div><div>- Richard</div></div>