forked from OSchip/llvm-project
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. llvm-svn: 134973
This commit is contained in:
parent
3f32d69699
commit
4a80f9fd98
|
@ -2952,7 +2952,7 @@ public:
|
|||
QualType desugar() const;
|
||||
|
||||
/// \brief Returns whether this type directly provides sugar.
|
||||
bool isSugared() const { return true; }
|
||||
bool isSugared() const;
|
||||
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == TypeOfExpr; }
|
||||
static bool classof(const TypeOfExprType *) { return true; }
|
||||
|
@ -2972,9 +2972,6 @@ public:
|
|||
DependentTypeOfExprType(const ASTContext &Context, Expr *E)
|
||||
: TypeOfExprType(E), Context(Context) { }
|
||||
|
||||
bool isSugared() const { return false; }
|
||||
QualType desugar() const { return QualType(this, 0); }
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) {
|
||||
Profile(ID, Context, getUnderlyingExpr());
|
||||
}
|
||||
|
@ -3025,10 +3022,10 @@ public:
|
|||
QualType getUnderlyingType() const { return UnderlyingType; }
|
||||
|
||||
/// \brief Remove a single level of sugar.
|
||||
QualType desugar() const { return getUnderlyingType(); }
|
||||
QualType desugar() const;
|
||||
|
||||
/// \brief Returns whether this type directly provides sugar.
|
||||
bool isSugared() const { return !isDependentType(); }
|
||||
bool isSugared() const;
|
||||
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == Decltype; }
|
||||
static bool classof(const DecltypeType *) { return true; }
|
||||
|
@ -3046,9 +3043,6 @@ class DependentDecltypeType : public DecltypeType, public llvm::FoldingSetNode {
|
|||
public:
|
||||
DependentDecltypeType(const ASTContext &Context, Expr *E);
|
||||
|
||||
bool isSugared() const { return false; }
|
||||
QualType desugar() const { return QualType(this, 0); }
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) {
|
||||
Profile(ID, Context, getUnderlyingExpr());
|
||||
}
|
||||
|
|
|
@ -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) { }
|
||||
|
||||
|
|
Loading…
Reference in New Issue