[cfe-commits] r68911 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseDecl.cpp test/Lexer/block_cmt_end.c test/Parser/declarators.c test/Parser/objc-foreach-syntax.m test/SemaObjC/exception-go-boom.m
Chris Lattner
sabre at nondot.org
Sun Apr 12 15:28:12 PDT 2009
On Apr 12, 2009, at 2:40 PM, Sebastian Redl wrote:
>> Implement the first set of changes for PR3963 and rdar://6759604,
>> which tries to do better error recovery when it is "obvious" that an
>> identifier is a mis-typed typename.
>
> Very, very cool. I think you have to work with MSVC's awful error
> recovery to *really* appreciate how nice this is.
:)
>> +/// isValidAfterIdentifierInDeclaratorAfterDeclSpec - Return true
>> if the
>> +/// specified token is valid after the identifier in a declarator
>> which
>> +/// immediately follows the declspec. For example, these things
>> are valid:
>> +///
>> +/// int x [ 4]; // direct-declarator
>> +/// int x ( int y); // direct-declarator
>> +/// int(int x ) // direct-declarator
>> +/// int x ; // simple-declaration
>> +/// int x = 17; // init-declarator-list
>> +/// int x , y; // init-declarator-list
>> +/// int x __asm__ ("foo"); // init-declarator-list
>> +///
>>
>
> We don't parse it yet, but in C++0x there's the unified initialization
> syntax, which makes this valid:
>
> int x {5};
Wow, that's annoying :). This isn't strictly needed at this point,
because C++ doesn't have implicit int. Since
isValidAfterIdentifierInDeclaratorAfterDeclSpec is only called on
"valid" code when it would be an implicit int, no C++ cases can
matter. However, I'd prefer to keep the interface to
isValidAfterIdentifierInDeclaratorAfterDeclSpec very simple and
context independent, so I'll add this. Thanks!
-Chris
More information about the cfe-commits
mailing list