diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-07-12 06:55:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-07-12 06:55:29 +0000 |
commit | 6af9f3ca25157379efd5c1caad82e9d01c17b9ff (patch) | |
tree | 06956d2a1ab9189c4c42e149abb23ba2f904dbbd /lib/AST/Type.cpp | |
parent | 3a2b657088de9413714a51bff153a59565adb3ef (diff) |
Fix the desugaring of dependent decltype and typeof(expr) nodes. The
isSugared() and desugar() routines previously provided were never
actually called, since the corresponding types
(DependentTypeOfExprType, DependentDecltypeType) don't have
corresponding type classes. Outside of the current (incomplete) patch
I'm working on, I haven't found a way to trigger this problem.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134973 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r-- | lib/AST/Type.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 20a0d595e4..89c00eb850 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -1645,8 +1645,15 @@ TypeOfExprType::TypeOfExprType(Expr *E, QualType can) TOExpr(E) { } +bool TypeOfExprType::isSugared() const { + return !TOExpr->isTypeDependent(); +} + QualType TypeOfExprType::desugar() const { - return getUnderlyingExpr()->getType(); + if (isSugared()) + return getUnderlyingExpr()->getType(); + + return QualType(this, 0); } void DependentTypeOfExprType::Profile(llvm::FoldingSetNodeID &ID, @@ -1663,6 +1670,15 @@ DecltypeType::DecltypeType(Expr *E, QualType underlyingType, QualType can) UnderlyingType(underlyingType) { } +bool DecltypeType::isSugared() const { return !E->isInstantiationDependent(); } + +QualType DecltypeType::desugar() const { + if (isSugared()) + return getUnderlyingType(); + + return QualType(this, 0); +} + DependentDecltypeType::DependentDecltypeType(const ASTContext &Context, Expr *E) : DecltypeType(E, Context.DependentTy), Context(Context) { } |