aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-01-26 20:04:03 +0000
committerJohn McCall <rjmccall@apple.com>2012-01-26 20:04:03 +0000
commite8c904ff343f440e213b88e6963f5ebfbec7ae60 (patch)
tree28fb35eddfe743a637e8435d64d93a92caf6dc00 /lib/Sema/SemaDeclAttr.cpp
parentb9cd498fd40fef5e2eed987ae2c31d0bfdf35f8d (diff)
Don't suppress access-control or invalid-type diagnostics from a
declarator just because we were able to build an invalid decl for it. The invalid-type diagnostics, in particular, are still useful to know, and may indicate something about why the decl is invalid. Also, recover from an illegal pointer/reference-to-unqualified-retainable type using __strong instead of __autoreleasing; in general, a random object is much more likely to be __strong, so this avoids unnecessary cascading errors in the most common case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index b15ad0ddd1..bdf95fa582 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -4033,7 +4033,7 @@ void Sema::DelayedDiagnostics::popParsingDecl(Sema &S, ParsingDeclState state,
// We only want to actually emit delayed diagnostics when we
// successfully parsed a decl.
- if (decl && !decl->isInvalidDecl()) {
+ if (decl) {
// We emit all the active diagnostics, not just those starting
// from the saved state. The idea is this: we get one push for a
// decl spec and another for each declarator; in a decl group like:
@@ -4048,7 +4048,9 @@ void Sema::DelayedDiagnostics::popParsingDecl(Sema &S, ParsingDeclState state,
switch (diag.Kind) {
case DelayedDiagnostic::Deprecation:
- S.HandleDelayedDeprecationCheck(diag, decl);
+ // Don't bother giving deprecation diagnostics if the decl is invalid.
+ if (!decl->isInvalidDecl())
+ S.HandleDelayedDeprecationCheck(diag, decl);
break;
case DelayedDiagnostic::Access: