]> granicus.if.org Git - clang/commitdiff
Avoid superfluous warning after an error is detcted and reported.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 19 Apr 2011 21:42:37 +0000 (21:42 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 19 Apr 2011 21:42:37 +0000 (21:42 +0000)
// rdar://9132143

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129822 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/Parser/cxx-decl.cpp

index ee76cc73a525ae80ad6d3c379f26fdbaf6a313fe..702f8c7cfb1e88406fe82eddb98820b5566946af 100644 (file)
@@ -1735,6 +1735,8 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
           DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
         PrevSpec = ""; // Not used by the diagnostic.
         DiagID = diag::err_bool_redeclaration;
+        // For better error recovery.
+        Tok.setKind(tok::identifier);
         isInvalid = true;
       } else {
         isInvalid = DS.SetTypeSpecType(DeclSpec::TST_bool, Loc, PrevSpec,
@@ -1856,7 +1858,8 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
     }
 
     DS.SetRangeEnd(Tok.getLocation());
-    ConsumeToken();
+    if (DiagID != diag::err_bool_redeclaration)
+      ConsumeToken();
   }
 }
 
index 6d720d36a259faacb7ec9619817deba1c05b786f..70eff973e0e1b59271b913207eb04efa87ceb927 100644 (file)
@@ -7,8 +7,8 @@ struct Type {
 };
 
 // rdar://8365458
-typedef char bool; // expected-error {{redeclaration of C++ built-in type 'bool'}} \
-                   // expected-warning {{declaration does not declare anything}}
+// rdar://9132143
+typedef char bool; // expected-error {{redeclaration of C++ built-in type 'bool'}}
 
 // PR4451 - We should recover well from the typo of '::' as ':' in a2.
 namespace y {