summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-07-08 00:03:05 +0000
committerDouglas Gregor <dgregor@apple.com>2009-07-08 00:03:05 +0000
commitabd6813ff9711818cde46efecfd7e0d7cc82e013 (patch)
tree5a968823ab5eaab5b740a82fc9499887e1243989 /clang/lib
parentf0080b734a86b236ffe5e56f926f1defac91e247 (diff)
downloadbcm5719-llvm-abd6813ff9711818cde46efecfd7e0d7cc82e013.tar.gz
bcm5719-llvm-abd6813ff9711818cde46efecfd7e0d7cc82e013.zip
The canonical type of typeof or decltype with a dependent type is itself,
not Context.DependentTy. I'll let Anders check in the test case for this one... llvm-svn: 74975
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ASTContext.cpp18
-rw-r--r--clang/lib/AST/Type.cpp4
2 files changed, 14 insertions, 8 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index c59a5d703bb..de4816c503b 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1901,8 +1901,13 @@ QualType ASTContext::getObjCQualifiedInterfaceType(ObjCInterfaceDecl *Decl,
/// DeclRefExpr's. This doesn't effect the type checker, since it operates
/// on canonical type's (which are always unique).
QualType ASTContext::getTypeOfExprType(Expr *tofExpr) {
- QualType Canonical = getCanonicalType(tofExpr->getType());
- TypeOfExprType *toe = new (*this,8) TypeOfExprType(tofExpr, Canonical);
+ TypeOfExprType *toe;
+ if (tofExpr->isTypeDependent())
+ toe = new (*this, 8) TypeOfExprType(tofExpr);
+ else {
+ QualType Canonical = getCanonicalType(tofExpr->getType());
+ toe = new (*this,8) TypeOfExprType(tofExpr, Canonical);
+ }
Types.push_back(toe);
return QualType(toe, 0);
}
@@ -1957,8 +1962,13 @@ static QualType getDecltypeForExpr(const Expr *e, ASTContext &Context) {
/// an issue. This doesn't effect the type checker, since it operates
/// on canonical type's (which are always unique).
QualType ASTContext::getDecltypeType(Expr *e) {
- QualType T = getDecltypeForExpr(e, *this);
- DecltypeType *dt = new (*this, 8) DecltypeType(e, getCanonicalType(T));
+ DecltypeType *dt;
+ if (e->isTypeDependent()) // FIXME: canonicalize the expression
+ dt = new (*this, 8) DecltypeType(e);
+ else {
+ QualType T = getDecltypeForExpr(e, *this);
+ dt = new (*this, 8) DecltypeType(e, 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 2b307c86e38..fa1c9152f44 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -1072,14 +1072,10 @@ QualType TypedefType::LookThroughTypedefs() const {
TypeOfExprType::TypeOfExprType(Expr *E, QualType can)
: Type(TypeOfExpr, can, E->isTypeDependent()), TOExpr(E) {
- assert(!isa<TypedefType>(can) && "Invalid canonical type");
}
DecltypeType::DecltypeType(Expr *E, QualType can)
: Type(Decltype, can, E->isTypeDependent()), E(E) {
- assert(can->isDependentType() == E->isTypeDependent() &&
- "type dependency mismatch!");
- assert(!isa<TypedefType>(can) && "Invalid canonical type");
}
TagType::TagType(TypeClass TC, TagDecl *D, QualType can)
OpenPOWER on IntegriCloud