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

llvm-svn: 97080
This commit is contained in:
Douglas Gregor 2010-02-24 23:50:37 +00:00
parent 651fe5ec20
commit cdbd51551b
5 changed files with 18 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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

View File

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