[cfe-commits] r110436 - in /cfe/trunk: include/clang/Basic/TokenKinds.def lib/Parse/ParseCXXInlineMethods.cpp lib/Parse/ParseDecl.cpp test/Parser/cxx-default-args.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Fri Aug 6 12:02:34 PDT 2010


On Aug 6, 2010, at 4:41 PM, Ted Kremenek wrote:

> On Aug 6, 2010, at 3:13 AM, Douglas Gregor <dgregor at apple.com> wrote:
> 
>>> +          assert(Tok.is(tok::cxx_defaultarg_end) &&
>>> +                 "We didn't parse the whole default arg!");
>>> +          ConsumeToken(); // Consume tok::cxx_defaultarg_end.
>> 
>> How about we SkipUntil the tok::cxx_defaultarg_end, and give an error if it's not the next token? That way, if expression parsing doesn't use up all of the tokens, we'll give a reasonable diagnostic rather than asserting.
> 
> +1.  Assertions for cases that might trigger on invalid code are highly undesirable.  I'm not certain if that is the case here, but it looks like it to me.

It won't be triggered on invalid code, it's supposed to be triggered when clang left tokens while no errors occured.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100806/e9746537/attachment.html>


More information about the cfe-commits mailing list