summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2014-01-09 20:19:45 +0000
committerTed Kremenek <kremenek@apple.com>2014-01-09 20:19:45 +0000
commitce0e3f8a0920b72703b13a032a1809fae65423ee (patch)
tree70d1e79a6e2a667ac37b29019b77bda4b5483e3f /clang/lib/Sema
parent7c1fcf8b2cabd683beac967cbedc187d19c23487 (diff)
downloadbcm5719-llvm-ce0e3f8a0920b72703b13a032a1809fae65423ee.tar.gz
bcm5719-llvm-ce0e3f8a0920b72703b13a032a1809fae65423ee.zip
Have attribute 'objc_precise_lifetime' suppress -Wunused.
Fixes <rdar://problem/15596883> In ARC, __attribute__((objc_precise_lifetime)) guarantees that the object stored in it will survive to the end of the variable's formal lifetime. It is therefore useful even if it completely unused. llvm-svn: 198888
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index fb041ed98c8..78ead1ee92b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1268,7 +1268,8 @@ static bool ShouldDiagnoseUnusedDecl(const NamedDecl *D) {
if (D->isInvalidDecl())
return false;
- if (D->isReferenced() || D->isUsed() || D->hasAttr<UnusedAttr>())
+ if (D->isReferenced() || D->isUsed() || D->hasAttr<UnusedAttr>() ||
+ D->hasAttr<ObjCPreciseLifetimeAttr>())
return false;
if (isa<LabelDecl>(D))
OpenPOWER on IntegriCloud