aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-04-19 21:42:37 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-04-19 21:42:37 +0000
commite106a0bfac30a8a215a68cc28aeb46b054dcb91f (patch)
tree25dc6d6e2f486b499fafb9b54bfdcfa80b41c991
parent0d027ba3e5b0e59ecde05747330a871ba174a0da (diff)
Avoid superfluous warning after an error is detcted and reported.
// rdar://9132143 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129822 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseDecl.cpp5
-rw-r--r--test/Parser/cxx-decl.cpp4
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index ee76cc73a5..702f8c7cfb 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -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();
}
}
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index 6d720d36a2..70eff973e0 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/test/Parser/cxx-decl.cpp
@@ -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 {