[cfe-commits] r75265 - in /cfe/trunk: include/clang/AST/Type.h lib/AST/ASTContext.cpp lib/AST/Type.cpp lib/CodeGen/CGDebugInfo.cpp
Anders Carlsson
andersca at mac.com
Fri Jul 10 12:20:27 PDT 2009
Author: andersca
Date: Fri Jul 10 14:20:26 2009
New Revision: 75265
URL: http://llvm.org/viewvc/llvm-project?rev=75265&view=rev
Log:
Fix a problem that Eli noticed, and that Doug helped me fix.
Modified:
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=75265&r1=75264&r2=75265&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Fri Jul 10 14:20:26 2009
@@ -1463,11 +1463,18 @@
/// DecltypeType (C++0x)
class DecltypeType : public Type {
Expr *E;
- DecltypeType(Expr *E, QualType can = QualType());
+
+ // FIXME: We could get rid of UnderlyingType if we wanted to: We would have to
+ // Move getDesugaredType to ASTContext so that it can call getDecltypeForExpr
+ // from it.
+ QualType UnderlyingType;
+
+ DecltypeType(Expr *E, QualType underlyingType, QualType can = QualType());
friend class ASTContext; // ASTContext creates these.
public:
Expr *getUnderlyingExpr() const { return E; }
-
+ QualType getUnderlyingType() const { return UnderlyingType; }
+
virtual void getAsStringInternal(std::string &InnerString,
const PrintingPolicy &Policy) const;
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=75265&r1=75264&r2=75265&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Jul 10 14:20:26 2009
@@ -1964,10 +1964,10 @@
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);
Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=75265&r1=75264&r2=75265&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Fri Jul 10 14:20:26 2009
@@ -124,8 +124,10 @@
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 @@
: 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)
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=75265&r1=75264&r2=75265&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Jul 10 14:20:26 2009
@@ -792,8 +792,8 @@
return Slot = getOrCreateType(cast<TypeOfType>(Ty)->getUnderlyingType(),
Unit);
case Type::Decltype:
- return Slot = getOrCreateType(cast<DecltypeType>(Ty)->getUnderlyingExpr()
- ->getType(), Unit);
+ return Slot = getOrCreateType(cast<DecltypeType>(Ty)->getUnderlyingType(),
+ Unit);
}
return Slot;
More information about the cfe-commits
mailing list