diff options
| author | John McCall <rjmccall@apple.com> | 2011-01-06 01:58:22 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2011-01-06 01:58:22 +0000 |
| commit | 8190451ddc7ee3021939ade3707cc5f6d7510188 (patch) | |
| tree | a22a3173b7b062e0a7f42f0c95dfcdb40fab520c /clang/lib/AST/ASTContext.cpp | |
| parent | 4072e59189fe077ffae359e99268193af8cedb1c (diff) | |
| download | bcm5719-llvm-8190451ddc7ee3021939ade3707cc5f6d7510188.tar.gz bcm5719-llvm-8190451ddc7ee3021939ade3707cc5f6d7510188.zip | |
Introduce an AttributedType, but don't actually use it anywhere yet.
The initial TreeTransform is a cop-out, but it's more-or-less equivalent
to what we were doing before, or rather what we're doing now and might
eventually stop doing in favor of using this type.
I am simultaneously intrigued by the possibilities of rebuilding a
dependent Attri
llvm-svn: 122942
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 6e7f7c31ea5..e76238cb221 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -844,6 +844,10 @@ ASTContext::getTypeInfo(const Type *T) { case Type::Elaborated: return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr()); + case Type::Attributed: + return getTypeInfo( + cast<AttributedType>(T)->getEquivalentType().getTypePtr()); + case Type::TemplateSpecialization: assert(getCanonicalType(T) != T && "Cannot request the size of a dependent type"); @@ -1875,6 +1879,27 @@ QualType ASTContext::getEnumType(const EnumDecl *Decl) { return QualType(Decl->TypeForDecl, 0); } +QualType ASTContext::getAttributedType(AttributedType::Kind attrKind, + QualType modifiedType, + QualType equivalentType) { + llvm::FoldingSetNodeID id; + AttributedType::Profile(id, attrKind, modifiedType, equivalentType); + + void *insertPos = 0; + AttributedType *type = AttributedTypes.FindNodeOrInsertPos(id, insertPos); + if (type) return QualType(type, 0); + + QualType canon = getCanonicalType(equivalentType); + type = new (*this, TypeAlignment) + AttributedType(canon, attrKind, modifiedType, equivalentType); + + Types.push_back(type); + AttributedTypes.InsertNode(type, insertPos); + + return QualType(type, 0); +} + + /// \brief Retrieve a substitution-result type. QualType ASTContext::getSubstTemplateTypeParmType(const TemplateTypeParmType *Parm, |

