summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorAlexis Hunt <alercah@gmail.com>2011-05-24 22:41:36 +0000
committerAlexis Hunt <alercah@gmail.com>2011-05-24 22:41:36 +0000
commite852b100e26c818788708a2379d047e157ea316f (patch)
tree4df08da63c06554866280991bc227909575cce98 /clang/lib/AST/ASTContext.cpp
parent93e7b3a8bdbe1a9edb1c3d6524ed858377b35e62 (diff)
downloadbcm5719-llvm-e852b100e26c818788708a2379d047e157ea316f.tar.gz
bcm5719-llvm-e852b100e26c818788708a2379d047e157ea316f.zip
Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to implement __underlying_type properly - with TypeSourceInfo and proper behavior in the face of templates. llvm-svn: 132017
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index e664855067f..f356c908e93 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -975,6 +975,9 @@ ASTContext::getTypeInfo(const Type *T) const {
return getTypeInfo(cast<DecltypeType>(T)->getUnderlyingExpr()->getType()
.getTypePtr());
+ case Type::UnaryTransform:
+ return getTypeInfo(cast<UnaryTransformType>(T)->getUnderlyingType());
+
case Type::Elaborated:
return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr());
@@ -1605,6 +1608,7 @@ QualType ASTContext::getVariableArrayDecayedType(QualType type) const {
case Type::TypeOfExpr:
case Type::TypeOf:
case Type::Decltype:
+ case Type::UnaryTransform:
case Type::DependentName:
case Type::InjectedClassName:
case Type::TemplateSpecialization:
@@ -2802,6 +2806,20 @@ QualType ASTContext::getDecltypeType(Expr *e) const {
return QualType(dt, 0);
}
+/// getUnaryTransformationType - We don't unique these, since the memory
+/// savings are minimal and these are rare.
+QualType ASTContext::getUnaryTransformType(QualType BaseType,
+ QualType UnderlyingType,
+ UnaryTransformType::UTTKind Kind)
+ const {
+ UnaryTransformType *Ty =
+ new UnaryTransformType (BaseType, UnderlyingType, Kind,
+ UnderlyingType->isDependentType() ?
+ QualType() : UnderlyingType);
+ Types.push_back(Ty);
+ return QualType(Ty, 0);
+}
+
/// getAutoType - We only unique auto types after they've been deduced.
QualType ASTContext::getAutoType(QualType DeducedType) const {
void *InsertPos = 0;
OpenPOWER on IntegriCloud