summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-03-05 22:43:32 +0000
committerTed Kremenek <kremenek@apple.com>2010-03-05 22:43:32 +0000
commit444b035b5325973bdd5a622006fda6367a670a94 (patch)
treea3fa922bd4a8956034215eebb05a0033dec80b07
parent34f6a322430e2cdcb38167781eb848b9b8e928bb (diff)
Augment __has_feature to report that Clang supports adding attribute 'unused'
to an Objective-C instance variable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97850 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Lex/PPMacroExpansion.cpp1
-rw-r--r--test/SemaObjC/unused.m10
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index d60cf0804f..5fe2ef172e 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -505,6 +505,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("attribute_cf_returns_retained", true)
.Case("attribute_ns_returns_not_retained", true)
.Case("attribute_ns_returns_retained", true)
+ .Case("attribute_objc_ivar_unused", true)
.Default(false);
}
diff --git a/test/SemaObjC/unused.m b/test/SemaObjC/unused.m
index e99418875a..a33a1bc02f 100644
--- a/test/SemaObjC/unused.m
+++ b/test/SemaObjC/unused.m
@@ -39,7 +39,15 @@ void test2() {
// instance variables, which GCC does not.
//===------------------------------------------------------------------------===
+#if __has_feature(attribute_objc_ivar_unused)
+#define UNUSED_IVAR __attribute__((unused))
+#else
+#error __attribute__((unused)) not supported on ivars
+#endif
+
@interface TestUnusedIvar {
- id x __attribute__((unused)); // no-warning
+ id y __attribute__((unused)); // no-warning
+ id x UNUSED_IVAR; // no-warning
}
@end
+