Keep track of the location of the '~' in a pseudo-destructor expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97080 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2010-02-24 23:50:37 +00:00
Родитель 26d4ac97fb
Коммит fce46ee68f
5 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -1047,6 +1047,9 @@ class CXXPseudoDestructorExpr : public Expr {
/// expression.
SourceLocation ColonColonLoc;
/// \brief The location of the '~'.
SourceLocation TildeLoc;
/// \brief The type being destroyed.
TypeSourceInfo *DestroyedType;
@ -1057,6 +1060,7 @@ public:
SourceRange QualifierRange,
TypeSourceInfo *ScopeType,
SourceLocation ColonColonLoc,
SourceLocation TildeLoc,
TypeSourceInfo *DestroyedType)
: Expr(CXXPseudoDestructorExprClass,
Context.getPointerType(Context.getFunctionType(Context.VoidTy, 0, 0,
@ -1069,7 +1073,7 @@ public:
Base(static_cast<Stmt *>(Base)), IsArrow(isArrow),
OperatorLoc(OperatorLoc), Qualifier(Qualifier),
QualifierRange(QualifierRange),
ScopeType(ScopeType), ColonColonLoc(ColonColonLoc),
ScopeType(ScopeType), ColonColonLoc(ColonColonLoc), TildeLoc(TildeLoc),
DestroyedType(DestroyedType) { }
void setBase(Expr *E) { Base = E; }
@ -1113,6 +1117,9 @@ public:
/// expression.
SourceLocation getColonColonLoc() const { return ColonColonLoc; }
/// \brief Retrieve the location of the '~'.
SourceLocation getTildeLoc() const { return TildeLoc; }
/// \brief Retrieve the type that is being destroyed.
QualType getDestroyedType() const { return DestroyedType->getType(); }

Просмотреть файл

@ -2187,6 +2187,7 @@ public:
const CXXScopeSpec &SS,
TypeSourceInfo *ScopeType,
SourceLocation CCLoc,
SourceLocation TildeLoc,
TypeSourceInfo *DestroyedType,
bool HasTrailingLParen);

Просмотреть файл

@ -2940,6 +2940,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
(NestedNameSpecifier *) SS.getScopeRep(),
SS.getRange(),
0, SourceLocation(),
MemberLoc,
DestroyedTypeInfo));
}

Просмотреть файл

@ -2433,6 +2433,7 @@ Sema::OwningExprResult Sema::BuildPseudoDestructorExpr(ExprArg Base,
const CXXScopeSpec &SS,
TypeSourceInfo *ScopeTypeInfo,
SourceLocation CCLoc,
SourceLocation TildeLoc,
TypeSourceInfo *DestructedTypeInfo,
bool HasTrailingLParen) {
assert(DestructedTypeInfo && "No destructed type in pseudo-destructor expr?");
@ -2513,6 +2514,7 @@ Sema::OwningExprResult Sema::BuildPseudoDestructorExpr(ExprArg Base,
SS.getRange(),
ScopeTypeInfo,
CCLoc,
TildeLoc,
DestructedTypeInfo));
if (HasTrailingLParen)
return move(Result);
@ -2789,8 +2791,8 @@ Sema::OwningExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
return BuildPseudoDestructorExpr(move(Base), OpLoc, OpKind, SS,
ScopeTypeInfo, CCLoc, DestructedTypeInfo,
HasTrailingLParen);
ScopeTypeInfo, CCLoc, TildeLoc,
DestructedTypeInfo, HasTrailingLParen);
}
CXXMemberCallExpr *Sema::BuildCXXMemberCallExpr(Expr *Exp,

Просмотреть файл

@ -888,6 +888,7 @@ public:
SourceRange QualifierRange,
TypeSourceInfo *ScopeType,
SourceLocation CCLoc,
SourceLocation TildeLoc,
TypeSourceInfo *DestroyedType);
/// \brief Build a new unary operator expression.
@ -4705,6 +4706,7 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
E->getQualifierRange(),
ScopeTypeInfo,
E->getColonColonLoc(),
E->getTildeLoc(),
DestroyedTypeInfo);
}
@ -5755,6 +5757,7 @@ TreeTransform<Derived>::RebuildCXXPseudoDestructorExpr(ExprArg Base,
SourceRange QualifierRange,
TypeSourceInfo *ScopeType,
SourceLocation CCLoc,
SourceLocation TildeLoc,
TypeSourceInfo *DestroyedType) {
CXXScopeSpec SS;
if (Qualifier) {
@ -5771,7 +5774,7 @@ TreeTransform<Derived>::RebuildCXXPseudoDestructorExpr(ExprArg Base,
// This pseudo-destructor expression is still a pseudo-destructor.
return SemaRef.BuildPseudoDestructorExpr(move(Base), OperatorLoc,
isArrow? tok::arrow : tok::period,
SS, ScopeType, CCLoc,
SS, ScopeType, CCLoc, TildeLoc,
DestroyedType,
/*FIXME?*/true);
}