summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-04-30 09:17:49 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-04-30 09:17:49 +0000
commitc1ce4f58e6721662f4be5421660eeee8d5df11ee (patch)
tree3cd49e01db22b2b28c30d646381380cf32e86ea4 /clang/lib/Sema/SemaExprCXX.cpp
parentb196374f5353f5cbc07c9ada633881196b367fb5 (diff)
downloadbcm5719-llvm-c1ce4f58e6721662f4be5421660eeee8d5df11ee.tar.gz
bcm5719-llvm-c1ce4f58e6721662f4be5421660eeee8d5df11ee.zip
Hoist all of the type-specific trait logic for __is_standard_layout into
a Type method isStandardLayoutType, to keep our user API matching the type trait builtins as closely as possible. Also, implement it in terms of other Type APIs rather than in terms of other type traits. This models the implementation on that of isLiteralType and isTrivialType. There remain some common problems with these traits still, so this is a bit of a WIP. However, we can now fix all of these traits at the same time and in a consistent manner. llvm-svn: 130602
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp17
1 files changed, 1 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index d975a155cd7..d87752081b3 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -2438,22 +2438,7 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, UnaryTypeTrait UTT, QualType T,
case UTT_IsSigned:
return T->isSignedIntegerType();
case UTT_IsStandardLayout:
- // Error if T is an incomplete type.
- if (Self.RequireCompleteType(KeyLoc, T, diag::err_incomplete_typeid))
- return false;
-
- // A standard layout type is:
- // - a scalar type
- // - an array of standard layout types
- // - a standard layout class type:
- if (EvaluateUnaryTypeTrait(Self, UTT_IsScalar, T, KeyLoc))
- return true;
- if (EvaluateUnaryTypeTrait(Self, UTT_IsScalar, C.getBaseElementType(T),
- KeyLoc))
- return true;
- if (const RecordType *RT = C.getBaseElementType(T)->getAs<RecordType>())
- return RT->hasStandardLayout();
- return false;
+ return T->isStandardLayoutType();
case UTT_IsUnsigned:
return T->isUnsignedIntegerType();
case UTT_IsVoid:
OpenPOWER on IntegriCloud