diff options
Diffstat (limited to 'src/TypeUtils.h')
-rw-r--r-- | src/TypeUtils.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/TypeUtils.h b/src/TypeUtils.h index b025d333..c2d9c527 100644 --- a/src/TypeUtils.h +++ b/src/TypeUtils.h @@ -124,13 +124,25 @@ namespace TypeUtils return at && at->getDeducedType().isNull(); } + inline const clang::Type * unpealAuto(clang::QualType q) + { + if (q.isNull()) + return nullptr; + + if (auto t = llvm::dyn_cast<clang::AutoType>(q.getTypePtr())) + return t->getDeducedType().getTypePtrOrNull(); + + return q.getTypePtr(); + } + /** * Returns true if childDecl is a descent from parentDecl **/ - CLAZYLIB_EXPORT bool derivesFrom(clang::CXXRecordDecl *derived, clang::CXXRecordDecl *possibleBase); + CLAZYLIB_EXPORT bool derivesFrom(const clang::CXXRecordDecl *derived, const clang::CXXRecordDecl *possibleBase, + std::vector<clang::CXXRecordDecl*> *baseClasses = nullptr); // Overload - CLAZYLIB_EXPORT bool derivesFrom(clang::CXXRecordDecl *derived, const std::string &possibleBase); + CLAZYLIB_EXPORT bool derivesFrom(const clang::CXXRecordDecl *derived, const std::string &possibleBase); // Overload CLAZYLIB_EXPORT bool derivesFrom(clang::QualType derived, const std::string &possibleBase); |