summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp1
-rw-r--r--clang/test/SemaCXX/warn-unused-member.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index c6aabde03e0..a46e31af446 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -632,6 +632,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("attribute_objc_method_family", true)
.Case("attribute_overloadable", true)
.Case("attribute_unavailable_with_message", true)
+ .Case("attribute_unused_on_fields", true)
.Case("blocks", LangOpts.Blocks)
.Case("cxx_exceptions", LangOpts.Exceptions)
.Case("cxx_rtti", LangOpts.RTTI)
diff --git a/clang/test/SemaCXX/warn-unused-member.cpp b/clang/test/SemaCXX/warn-unused-member.cpp
index cabc9b6cd6a..6a7922e8e55 100644
--- a/clang/test/SemaCXX/warn-unused-member.cpp
+++ b/clang/test/SemaCXX/warn-unused-member.cpp
@@ -144,6 +144,13 @@ class EverythingUsed {
int by_initializer_;
};
+class HasFeatureTest {
+#if __has_feature(attribute_unused_on_fields)
+ int unused_; // expected-warning{{private field 'unused_' is not used}}
+ int unused2_ __attribute__((unused)); // no-warning
+#endif
+};
+
namespace templates {
class B {
template <typename T> void f(T t);
OpenPOWER on IntegriCloud