diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-01-05 20:52:13 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-01-05 20:52:13 +0000 |
commit | 64b45f7e0d3167f040841ac2920aead7f080730d (patch) | |
tree | 0b003e97e87dbd53cce77cf6476cd72427fa6d6c /lib/AST/StmtSerialization.cpp | |
parent | a5677511d14bbe6181de423fb5f3cafacbdbe87c (diff) |
PODness and Type Traits
Make C++ classes track the POD property (C++ [class]p4)
Track the existence of a copy assignment operator.
Implicitly declare the copy assignment operator if none is provided.
Implement most of the parsing job for the G++ type traits extension.
Fully implement the low-hanging fruit of the type traits:
__is_pod: Whether a type is a POD.
__is_class: Whether a type is a (non-union) class.
__is_union: Whether a type is a union.
__is_enum: Whether a type is an enum.
__is_polymorphic: Whether a type is polymorphic (C++ [class.virtual]p1).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61746 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/StmtSerialization.cpp')
-rw-r--r-- | lib/AST/StmtSerialization.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/AST/StmtSerialization.cpp b/lib/AST/StmtSerialization.cpp index 3f7c0384d7..f7c4cf9b93 100644 --- a/lib/AST/StmtSerialization.cpp +++ b/lib/AST/StmtSerialization.cpp @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "clang/Basic/TypeTraits.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/ExprObjC.h" @@ -1530,6 +1531,24 @@ CXXDependentNameExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) { return new CXXDependentNameExpr(N, Ty, L); } +void UnaryTypeTraitExpr::EmitImpl(llvm::Serializer& S) const { + S.EmitInt(UTT); + S.Emit(Loc); + S.Emit(RParen); + S.Emit(QueriedType); + S.Emit(getType()); +} + +UnaryTypeTraitExpr * +UnaryTypeTraitExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) { + UnaryTypeTrait UTT = static_cast<UnaryTypeTrait>(D.ReadInt()); + SourceLocation Loc = SourceLocation::ReadVal(D); + SourceLocation RParen = SourceLocation::ReadVal(D); + QualType QueriedType = QualType::ReadVal(D); + QualType Ty = QualType::ReadVal(D); + return new UnaryTypeTraitExpr(Loc, UTT, QueriedType, RParen, Ty); +} + void CXXCatchStmt::EmitImpl(llvm::Serializer& S) const { S.Emit(CatchLoc); S.EmitOwnedPtr(ExceptionDecl); |