[cfe-commits] r97080 - in /cfe/trunk: include/clang/AST/ExprCXX.h lib/Sema/Sema.h lib/Sema/SemaExpr.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/TreeTransform.h

Douglas Gregor dgregor at apple.com
Wed Feb 24 15:50:38 PST 2010


Author: dgregor
Date: Wed Feb 24 17:50:37 2010
New Revision: 97080

URL: http://llvm.org/viewvc/llvm-project?rev=97080&view=rev
Log:
Keep track of the location of the '~' in a pseudo-destructor expression.

Modified:
    cfe/trunk/include/clang/AST/ExprCXX.h
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/lib/Sema/TreeTransform.h

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=97080&r1=97079&r2=97080&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Wed Feb 24 17:50:37 2010
@@ -1047,6 +1047,9 @@
   /// expression.
   SourceLocation ColonColonLoc;
   
+  /// \brief The location of the '~'.
+  SourceLocation TildeLoc;
+  
   /// \brief The type being destroyed.
   TypeSourceInfo *DestroyedType;
 
@@ -1057,6 +1060,7 @@
                           SourceRange QualifierRange,
                           TypeSourceInfo *ScopeType,
                           SourceLocation ColonColonLoc,
+                          SourceLocation TildeLoc,
                           TypeSourceInfo *DestroyedType)
     : Expr(CXXPseudoDestructorExprClass,
            Context.getPointerType(Context.getFunctionType(Context.VoidTy, 0, 0,
@@ -1069,7 +1073,7 @@
       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 @@
   /// 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(); }
 

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=97080&r1=97079&r2=97080&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Wed Feb 24 17:50:37 2010
@@ -2187,6 +2187,7 @@
                                              const CXXScopeSpec &SS,
                                              TypeSourceInfo *ScopeType,
                                              SourceLocation CCLoc,
+                                             SourceLocation TildeLoc,
                                              TypeSourceInfo *DestroyedType,
                                              bool HasTrailingLParen);
   

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=97080&r1=97079&r2=97080&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Feb 24 17:50:37 2010
@@ -2940,6 +2940,7 @@
                                (NestedNameSpecifier *) SS.getScopeRep(),
                                                        SS.getRange(),
                                                        0, SourceLocation(),
+                                                       MemberLoc,
                                                        DestroyedTypeInfo));
   }
 

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=97080&r1=97079&r2=97080&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed Feb 24 17:50:37 2010
@@ -2433,6 +2433,7 @@
                                                        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 @@
                                                   SS.getRange(),
                                                   ScopeTypeInfo,
                                                   CCLoc,
+                                                  TildeLoc,
                                                   DestructedTypeInfo));
   if (HasTrailingLParen)
     return move(Result);
@@ -2789,8 +2791,8 @@
 
     
   return BuildPseudoDestructorExpr(move(Base), OpLoc, OpKind, SS,
-                                   ScopeTypeInfo, CCLoc, DestructedTypeInfo,
-                                   HasTrailingLParen);
+                                   ScopeTypeInfo, CCLoc, TildeLoc,
+                                   DestructedTypeInfo, HasTrailingLParen);
 }
 
 CXXMemberCallExpr *Sema::BuildCXXMemberCallExpr(Expr *Exp, 

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=97080&r1=97079&r2=97080&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Wed Feb 24 17:50:37 2010
@@ -888,6 +888,7 @@
                                                   SourceRange QualifierRange,
                                                   TypeSourceInfo *ScopeType,
                                                   SourceLocation CCLoc,
+                                                  SourceLocation TildeLoc,
                                                 TypeSourceInfo *DestroyedType);
 
   /// \brief Build a new unary operator expression.
@@ -4705,6 +4706,7 @@
                                                      E->getQualifierRange(),
                                                      ScopeTypeInfo,
                                                      E->getColonColonLoc(),
+                                                     E->getTildeLoc(),
                                                      DestroyedTypeInfo);
 }
 
@@ -5755,6 +5757,7 @@
                                                      SourceRange QualifierRange,
                                                      TypeSourceInfo *ScopeType,
                                                        SourceLocation CCLoc,
+                                                       SourceLocation TildeLoc,
                                                TypeSourceInfo *DestroyedType) {
   CXXScopeSpec SS;
   if (Qualifier) {
@@ -5771,7 +5774,7 @@
     // 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);
   }





More information about the cfe-commits mailing list