aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprCXX.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-09-02 23:19:42 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-09-02 23:19:42 +0000
commitd4b25cbde13fc973673234f26de48c940723e679 (patch)
treee6a44baf010ac414a70257a6183cb57de96eed9b /lib/AST/ExprCXX.cpp
parent6b61fcd47fe94a88899a95b9e73b600257735286 (diff)
Implement __has_virtual_destructor. Patch by Steven Watanabe.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112905 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprCXX.cpp')
-rw-r--r--lib/AST/ExprCXX.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index ae57f4cd67..0a101300d8 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -488,6 +488,16 @@ bool UnaryTypeTraitExpr::EvaluateTrait(ASTContext& C) const {
}
}
return false;
+ case UTT_HasVirtualDestructor:
+ // http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html:
+ // If type is a class type with a virtual destructor ([class.dtor])
+ // then the trait is true, else it is false.
+ if (const RecordType *Record = QueriedType->getAs<RecordType>()) {
+ CXXRecordDecl *RD = cast<CXXRecordDecl>(Record->getDecl());
+ if (CXXDestructorDecl *Destructor = RD->getDestructor())
+ return Destructor->isVirtual();
+ }
+ return false;
}
}