Non-void functions need to return some value.

llvm-svn: 125185
This commit is contained in:
Nick Lewycky 2011-02-09 08:42:57 +00:00
parent f75152fb9f
commit bae992ffd9
1 changed files with 13 additions and 5 deletions

View File

@ -91,15 +91,23 @@ namespace {
// These silly little functions have to be static inline to suppress
// unused warnings, and they have to be defined to suppress other
// warnings.
static inline good is_good(good) {}
static inline good is_good(good) { return good(); }
typedef Stmt::child_range children_t();
template <class T> good implements_children(children_t T::*) {}
static inline bad implements_children(children_t Stmt::*) {}
template <class T> good implements_children(children_t T::*) {
return good();
}
static inline bad implements_children(children_t Stmt::*) {
return bad();
}
typedef SourceRange getSourceRange_t() const;
template <class T> good implements_getSourceRange(getSourceRange_t T::*) {}
static inline bad implements_getSourceRange(getSourceRange_t Stmt::*) {}
template <class T> good implements_getSourceRange(getSourceRange_t T::*) {
return good();
}
static inline bad implements_getSourceRange(getSourceRange_t Stmt::*) {
return bad();
}
#define ASSERT_IMPLEMENTS_children(type) \
(void) sizeof(is_good(implements_children(&type::children)))