Implement basic __is_trivial type-trait support, enough to close PR9472.
This introduces a few APIs on the AST to bundle up the standard-based
logic so that programmatic clients have access to exactly the same
behavior.
There is only one serious FIXME here: checking for non-trivial move
constructors and move assignment operators. Those bits need to be added
to the declaration and accessors provided.
This implementation should be enough for the uses of __is_trivial in
libstdc++ 4.6's C++98 library implementation.
Ideas for more thorough test cases or any edge cases missing would be
appreciated. =D
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130057 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index c6a8210..27545d8 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -2362,6 +2362,7 @@
default: assert(false && "Unknown type trait or not implemented");
case UTT_IsPOD: return T->isPODType();
case UTT_IsLiteral: return T->isLiteralType();
+ case UTT_IsTrivial: return T->isTrivialType();
case UTT_IsClass: // Fallthrough
case UTT_IsUnion:
if (const RecordType *Record = T->getAs<RecordType>()) {