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
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index fb041ed..78ead1e 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1268,7 +1268,8 @@
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))