diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-07-10 19:20:26 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-07-10 19:20:26 +0000 |
| commit | ea1cfb415bdb4c7ae59868db4f883f557ea0b794 (patch) | |
| tree | 573f3190629954c5aa082b10a40b1c54861464a9 /clang/lib/AST | |
| parent | f075943584dc5bada7ef09f89b706a0b5f7e591a (diff) | |
| download | bcm5719-llvm-ea1cfb415bdb4c7ae59868db4f883f557ea0b794.tar.gz bcm5719-llvm-ea1cfb415bdb4c7ae59868db4f883f557ea0b794.zip | |
Fix a problem that Eli noticed, and that Doug helped me fix.
llvm-svn: 75265
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/AST/Type.cpp | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index de4816c503b..2bd1482adc2 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1964,10 +1964,10 @@ static QualType getDecltypeForExpr(const Expr *e, ASTContext &Context) { QualType ASTContext::getDecltypeType(Expr *e) { DecltypeType *dt; if (e->isTypeDependent()) // FIXME: canonicalize the expression - dt = new (*this, 8) DecltypeType(e); + dt = new (*this, 8) DecltypeType(e, DependentTy); else { QualType T = getDecltypeForExpr(e, *this); - dt = new (*this, 8) DecltypeType(e, getCanonicalType(T)); + dt = new (*this, 8) DecltypeType(e, T, getCanonicalType(T)); } Types.push_back(dt); return QualType(dt, 0); diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index d5dd776b7df..78c3b78977d 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -124,8 +124,10 @@ QualType Type::getDesugaredType(bool ForDisplay) const { return TOE->getUnderlyingExpr()->getType().getDesugaredType(); if (const TypeOfType *TOT = dyn_cast<TypeOfType>(this)) return TOT->getUnderlyingType().getDesugaredType(); - if (const DecltypeType *DTT = dyn_cast<DecltypeType>(this)) - return DTT->getCanonicalTypeInternal(); + if (const DecltypeType *DTT = dyn_cast<DecltypeType>(this)) { + if (!DTT->getUnderlyingType()->isDependentType()) + return DTT->getUnderlyingType().getDesugaredType(); + } if (const TemplateSpecializationType *Spec = dyn_cast<TemplateSpecializationType>(this)) { if (ForDisplay) @@ -1074,8 +1076,9 @@ TypeOfExprType::TypeOfExprType(Expr *E, QualType can) : Type(TypeOfExpr, can, E->isTypeDependent()), TOExpr(E) { } -DecltypeType::DecltypeType(Expr *E, QualType can) - : Type(Decltype, can, E->isTypeDependent()), E(E) { +DecltypeType::DecltypeType(Expr *E, QualType underlyingType, QualType can) + : Type(Decltype, can, E->isTypeDependent()), E(E), + UnderlyingType(underlyingType) { } TagType::TagType(TypeClass TC, TagDecl *D, QualType can) |

