diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 1 | ||||
-rw-r--r-- | clang/test/SemaObjC/unused.m | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index d60cf0804f5..5fe2ef172e2 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/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/clang/test/SemaObjC/unused.m b/clang/test/SemaObjC/unused.m index e99418875ae..a33a1bc02f9 100644 --- a/clang/test/SemaObjC/unused.m +++ b/clang/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 + |