diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2013-09-10 22:57:15 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2013-09-10 22:57:15 +0000 |
| commit | dc41d791f9949f8674d8709b35c72ea1e4168ae9 (patch) | |
| tree | a0b36083bf8b65b274b6addf04fa1cabb7b22954 | |
| parent | 1891f693238be703c46265520aa781c64ebe9e75 (diff) | |
| download | bcm5719-llvm-dc41d791f9949f8674d8709b35c72ea1e4168ae9.tar.gz bcm5719-llvm-dc41d791f9949f8674d8709b35c72ea1e4168ae9.zip | |
Add unused markings to suppress warnings.
trunk clang is a bit more aggressive about emitting unused-declaration
warnings, so adjust some AST code to match. Specifically, use
LLVM_ATTRIBUTE_UNUSED for declarations which are never supposed to be
referenced, and turn references to declarations which are supposed to be
referenced into odr-uses.
llvm-svn: 190443
| -rw-r--r-- | clang/lib/AST/Comment.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/AST/Stmt.cpp | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp index 79cabdb7766..f24a23d34c5 100644 --- a/clang/lib/AST/Comment.cpp +++ b/clang/lib/AST/Comment.cpp @@ -42,14 +42,16 @@ good implements_child_begin_end(Comment::child_iterator (T::*)() const) { return good(); } +LLVM_ATTRIBUTE_UNUSED static inline bad implements_child_begin_end( Comment::child_iterator (Comment::*)() const) { return bad(); } #define ASSERT_IMPLEMENTS_child_begin(function) \ - (void) sizeof(good(implements_child_begin_end(function))) + (void) good(implements_child_begin_end(function)) +LLVM_ATTRIBUTE_UNUSED static inline void CheckCommentASTNodes() { #define ABSTRACT_COMMENT(COMMENT) #define COMMENT(CLASS, PARENT) \ diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index b83bd7f5d6e..03215927440 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -135,6 +135,7 @@ namespace { template <class T> good implements_children(children_t T::*) { return good(); } + LLVM_ATTRIBUTE_UNUSED static inline bad implements_children(children_t Stmt::*) { return bad(); } @@ -143,6 +144,7 @@ namespace { template <class T> good implements_getLocStart(getLocStart_t T::*) { return good(); } + LLVM_ATTRIBUTE_UNUSED static inline bad implements_getLocStart(getLocStart_t Stmt::*) { return bad(); } @@ -151,20 +153,22 @@ namespace { template <class T> good implements_getLocEnd(getLocEnd_t T::*) { return good(); } + LLVM_ATTRIBUTE_UNUSED static inline bad implements_getLocEnd(getLocEnd_t Stmt::*) { return bad(); } #define ASSERT_IMPLEMENTS_children(type) \ - (void) sizeof(is_good(implements_children(&type::children))) + (void) is_good(implements_children(&type::children)) #define ASSERT_IMPLEMENTS_getLocStart(type) \ - (void) sizeof(is_good(implements_getLocStart(&type::getLocStart))) + (void) is_good(implements_getLocStart(&type::getLocStart)) #define ASSERT_IMPLEMENTS_getLocEnd(type) \ - (void) sizeof(is_good(implements_getLocEnd(&type::getLocEnd))) + (void) is_good(implements_getLocEnd(&type::getLocEnd)) } /// Check whether the various Stmt classes implement their member /// functions. +LLVM_ATTRIBUTE_UNUSED static inline void check_implementations() { #define ABSTRACT_STMT(type) #define STMT(type, base) \ |

