diff options
| author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-12-10 16:29:40 +0000 |
|---|---|---|
| committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-12-10 16:29:40 +0000 |
| commit | 924a8f3573a64797a7080061a586e3b4de8a41ae (patch) | |
| tree | 33e351a46eeb5b90a1a0917b98003029c1fe5e58 /clang/lib/AST/ASTContext.cpp | |
| parent | d672b5c32f3d79524c9e0b4e5b55a6fd6bc5581a (diff) | |
| download | bcm5719-llvm-924a8f3573a64797a7080061a586e3b4de8a41ae.tar.gz bcm5719-llvm-924a8f3573a64797a7080061a586e3b4de8a41ae.zip | |
Added ParenType type node.
llvm-svn: 121488
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index dfdc505b1ad..ecba4a136fc 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -811,6 +811,9 @@ ASTContext::getTypeInfo(const Type *T) { return getTypeInfo(cast<SubstTemplateTypeParmType>(T)-> getReplacementType().getTypePtr()); + case Type::Paren: + return getTypeInfo(cast<ParenType>(T)->getInnerType().getTypePtr()); + case Type::Typedef: { const TypedefDecl *Typedef = cast<TypedefType>(T)->getDecl(); std::pair<uint64_t, unsigned> Info @@ -1147,6 +1150,13 @@ static QualType getExtFunctionType(ASTContext& Context, QualType T, return T; ResultType = Context.getPointerType(ResultType); + } else if (const ParenType *Paren = T->getAs<ParenType>()) { + QualType Inner = Paren->getInnerType(); + ResultType = getExtFunctionType(Context, Inner, Info); + if (ResultType == Inner) + return T; + + ResultType = Context.getParenType(ResultType); } else if (const BlockPointerType *BlockPointer = T->getAs<BlockPointerType>()) { QualType Pointee = BlockPointer->getPointeeType(); @@ -2095,6 +2105,30 @@ ASTContext::getElaboratedType(ElaboratedTypeKeyword Keyword, return QualType(T, 0); } +QualType +ASTContext::getParenType(QualType InnerType) { + llvm::FoldingSetNodeID ID; + ParenType::Profile(ID, InnerType); + + void *InsertPos = 0; + ParenType *T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos); + if (T) + return QualType(T, 0); + + QualType Canon = InnerType; + if (!Canon.isCanonical()) { + Canon = getCanonicalType(InnerType); + ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos); + assert(!CheckT && "Paren canonical type broken"); + (void)CheckT; + } + + T = new (*this) ParenType(InnerType, Canon); + Types.push_back(T); + ParenTypes.InsertNode(T, InsertPos); + return QualType(T, 0); +} + QualType ASTContext::getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, |

