diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-04-01 22:41:11 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-04-01 22:41:11 +0000 |
| commit | e3e01a20d0072aa2d945f6fb5ddded0b408e6710 (patch) | |
| tree | 851cf3ac91db85e9145335ce0ba292cdc0ed6144 /clang/lib/Parse/ParseDecl.cpp | |
| parent | ec9c58f7e5678156c5a1bd84a12e5fce6d918c2c (diff) | |
| download | bcm5719-llvm-e3e01a20d0072aa2d945f6fb5ddded0b408e6710.tar.gz bcm5719-llvm-e3e01a20d0072aa2d945f6fb5ddded0b408e6710.zip | |
Add code modification hints to various parsing-related diagnostics.
Plus, reword a extension warnings to avoid talking about "ISO C" when
the extension might also be available in C++ or C++0x.
llvm-svn: 68257
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
| -rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index e233a221628..104ca0336b5 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -496,7 +496,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, DoneWithDeclSpec: // If this is not a declaration specifier token, we're done reading decl // specifiers. First verify that DeclSpec's are consistent. - DS.Finish(Diags, PP.getSourceManager(), getLang()); + DS.Finish(Diags, PP); return; case tok::coloncolon: // ::foo::bar @@ -1169,7 +1169,8 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, // Check for extraneous top-level semicolon. if (Tok.is(tok::semi)) { - Diag(Tok, diag::ext_extra_struct_semi); + Diag(Tok, diag::ext_extra_struct_semi) + << CodeModificationHint::CreateRemoval(SourceRange(Tok.getLocation())); ConsumeToken(); continue; } @@ -1372,8 +1373,11 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) { break; SourceLocation CommaLoc = ConsumeToken(); - if (Tok.isNot(tok::identifier) && !getLang().C99) - Diag(CommaLoc, diag::ext_c99_enumerator_list_comma); + if (Tok.isNot(tok::identifier) && + !(getLang().C99 || getLang().CPlusPlus0x)) + Diag(CommaLoc, diag::ext_enumerator_list_comma) + << getLang().CPlusPlus + << CodeModificationHint::CreateRemoval((SourceRange(CommaLoc))); } // Eat the }. @@ -1625,7 +1629,7 @@ void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, bool AttributesAllowed) { DoneWithTypeQuals: // If this is not a type-qualifier token, we're done reading type // qualifiers. First verify that DeclSpec's are consistent. - DS.Finish(Diags, PP.getSourceManager(), getLang()); + DS.Finish(Diags, PP); return; } |

