[cfe-commits] r145372 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseDecl.cpp lib/Parse/ParseTemplate.cpp test/FixIt/fixit-cxx0x.cpp test/FixIt/fixit.c test/FixIt/fixit.cpp test/SemaCXX/typedef-redecl.cpp

David Blaikie dblaikie at gmail.com
Mon Nov 28 22:23:15 PST 2011


It'd also be rather easy to implement a fixit for this recovery too,
just on the diagnostic a few lines above:

      Diag(Tok, diag::err_function_declared_typedef) <<
FixItHint::CreateRemoval(DS.getStorageClassSpecLoc());

On Mon, Nov 28, 2011 at 10:07 PM, Chandler Carruth <chandlerc at google.com> wrote:
> Your commit message doesn't mention this other recovery change:
> On Mon, Nov 28, 2011 at 9:27 PM, Richard Smith <richard-llvm at metafoo.co.uk>
> wrote:
>>
>> -      if (Tok.is(tok::l_brace)) {
>> -        // This recovery skips the entire function body. It would be nice
>> -        // to simply call ParseFunctionDefinition() below, however Sema
>> -        // assumes the declarator represents a function, not a typedef.
>> -        ConsumeBrace();
>> -        SkipUntil(tok::r_brace, true);
>> -      } else {
>> -        SkipUntil(tok::semi);
>> -      }
>> -      return 0;
>> +      // Recover by ignoring the 'typedef'.
>> +      DS.ClearStorageClassSpecs();
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>




More information about the cfe-commits mailing list