[cfe-commits] r127536 - in /cfe/trunk: include/clang/AST/TypeLoc.h include/clang/Sema/DeclSpec.h lib/Parse/ParseDecl.cpp lib/Sema/DeclSpec.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExceptionSpec.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaType.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReader.cpp lib/Serialization/ASTWriter.cpp

Abramo Bagnara abramo.bagnara at gmail.com
Sat Mar 12 03:17:06 PST 2011


Author: abramo
Date: Sat Mar 12 05:17:06 2011
New Revision: 127536

URL: http://llvm.org/viewvc/llvm-project?rev=127536&view=rev
Log:
Forgotten part of previous commit.

Modified:
    cfe/trunk/include/clang/AST/TypeLoc.h
    cfe/trunk/include/clang/Sema/DeclSpec.h
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/lib/Sema/DeclSpec.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/lib/Sema/TreeTransform.h
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/AST/TypeLoc.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TypeLoc.h (original)
+++ cfe/trunk/include/clang/AST/TypeLoc.h Sat Mar 12 05:17:06 2011
@@ -1033,7 +1033,8 @@
 
 
 struct FunctionLocInfo {
-  SourceLocation LParenLoc, RParenLoc;
+  SourceLocation LocalRangeBegin;
+  SourceLocation LocalRangeEnd;
   bool TrailingReturn;
 };
 
@@ -1043,18 +1044,18 @@
                                                FunctionType,
                                                FunctionLocInfo> {
 public:
-  SourceLocation getLParenLoc() const {
-    return getLocalData()->LParenLoc;
+  SourceLocation getLocalRangeBegin() const {
+    return getLocalData()->LocalRangeBegin;
   }
-  void setLParenLoc(SourceLocation Loc) {
-    getLocalData()->LParenLoc = Loc;
+  void setLocalRangeBegin(SourceLocation L) {
+    getLocalData()->LocalRangeBegin = L;
   }
 
-  SourceLocation getRParenLoc() const {
-    return getLocalData()->RParenLoc;
+  SourceLocation getLocalRangeEnd() const {
+    return getLocalData()->LocalRangeEnd;
   }
-  void setRParenLoc(SourceLocation Loc) {
-    getLocalData()->RParenLoc = Loc;
+  void setLocalRangeEnd(SourceLocation L) {
+    getLocalData()->LocalRangeEnd = L;
   }
 
   bool getTrailingReturn() const {
@@ -1082,12 +1083,12 @@
   }
 
   SourceRange getLocalSourceRange() const {
-    return SourceRange(getLParenLoc(), getRParenLoc());
+    return SourceRange(getLocalRangeBegin(), getLocalRangeEnd());
   }
 
   void initializeLocal(ASTContext &Context, SourceLocation Loc) {
-    setLParenLoc(Loc);
-    setRParenLoc(Loc);
+    setLocalRangeBegin(Loc);
+    setLocalRangeEnd(Loc);
     setTrailingReturn(false);
     for (unsigned i = 0, e = getNumArgs(); i != e; ++i)
       setArg(i, NULL);

Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Sat Mar 12 05:17:06 2011
@@ -1240,7 +1240,8 @@
                                      SourceRange *ExceptionRanges,
                                      unsigned NumExceptions,
                                      Expr *NoexceptExpr,
-                                     SourceLocation LPLoc, SourceLocation RPLoc,
+                                     SourceLocation LocalRangeBegin,
+                                     SourceLocation LocalRangeEnd,
                                      Declarator &TheDeclarator,
                                      ParsedType TrailingReturnType =
                                                     ParsedType());

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Sat Mar 12 05:17:06 2011
@@ -2601,7 +2601,9 @@
     else
       Diag(Loc, diag::err_attributes_not_allowed);
   }
-  
+
+  SourceLocation EndLoc;
+
   while (1) {
     bool isInvalid = false;
     const char *PrevSpec = 0;
@@ -2654,6 +2656,8 @@
       // If this is not a type-qualifier token, we're done reading type
       // qualifiers.  First verify that DeclSpec's are consistent.
       DS.Finish(Diags, PP);
+      if (EndLoc.isValid())
+        DS.SetRangeEnd(EndLoc);
       return;
     }
 
@@ -2662,7 +2666,7 @@
       assert(PrevSpec && "Method did not return previous specifier!");
       Diag(Tok, DiagID) << PrevSpec;
     }
-    ConsumeToken();
+    EndLoc = ConsumeToken();
   }
 }
 
@@ -3144,8 +3148,7 @@
     if (RequiresArg)
       Diag(Tok, diag::err_argument_required_after_attribute);
 
-    SourceLocation RParenLoc = ConsumeParen();  // Eat the closing ')'.
-    SourceLocation EndLoc = RParenLoc;
+    SourceLocation EndLoc = ConsumeParen();  // Eat the closing ')'.
 
     // cv-qualifier-seq[opt].
     DeclSpec DS;
@@ -3167,7 +3170,7 @@
       if (Tok.is(tok::amp) || Tok.is(tok::ampamp)) {
         if (!getLang().CPlusPlus0x)
           Diag(Tok, diag::ext_ref_qualifier);
-        
+
         RefQualifierIsLValueRef = Tok.is(tok::amp);
         RefQualifierLoc = ConsumeToken();
         EndLoc = RefQualifierLoc;
@@ -3203,7 +3206,7 @@
                                                DynamicExceptions.size(),
                                                NoexceptExpr.isUsable() ?
                                                  NoexceptExpr.get() : 0,
-                                               LParenLoc, RParenLoc, D,
+                                               LParenLoc, EndLoc, D,
                                                TrailingReturnType),
                   EndLoc);
     return;
@@ -3393,8 +3396,7 @@
   }
 
   // If we have the closing ')', eat it.
-  SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
-  SourceLocation EndLoc = RParenLoc;
+  SourceLocation EndLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
 
   DeclSpec DS;
   SourceLocation RefQualifierLoc;
@@ -3458,7 +3460,7 @@
                                              DynamicExceptions.size(),
                                              NoexceptExpr.isUsable() ?
                                                NoexceptExpr.get() : 0,
-                                             LParenLoc, RParenLoc, D,
+                                             LParenLoc, EndLoc, D,
                                              TrailingReturnType),
                 EndLoc);
 }

Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Sat Mar 12 05:17:06 2011
@@ -149,14 +149,14 @@
                                              SourceRange *ExceptionRanges,
                                              unsigned NumExceptions,
                                              Expr *NoexceptExpr,
-                                             SourceLocation LPLoc,
-                                             SourceLocation RPLoc,
+                                             SourceLocation LocalRangeBegin,
+                                             SourceLocation LocalRangeEnd,
                                              Declarator &TheDeclarator,
                                              ParsedType TrailingReturnType) {
   DeclaratorChunk I;
   I.Kind                        = Function;
-  I.Loc                         = LPLoc;
-  I.EndLoc                      = RPLoc;
+  I.Loc                         = LocalRangeBegin;
+  I.EndLoc                      = LocalRangeEnd;
   I.Fun.AttrList                = attrs.getList();
   I.Fun.hasPrototype            = hasProto;
   I.Fun.isVariadic              = isVariadic;

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat Mar 12 05:17:06 2011
@@ -7440,10 +7440,14 @@
 ///
 /// \param InitRange the source range that covers the "0" initializer.
 bool Sema::CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange) {
+  SourceLocation EndLoc = InitRange.getEnd();
+  if (EndLoc.isValid())
+    Method->setRangeEnd(EndLoc);
+
   if (Method->isVirtual() || Method->getParent()->isDependentContext()) {
     Method->setPure();
     return false;
-  } 
+  }
 
   if (!Method->isInvalidDecl())
     Diag(Method->getLocation(), diag::err_non_virtual_pure)

Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Sat Mar 12 05:17:06 2011
@@ -194,14 +194,14 @@
     OS << ")";
     OS.flush();
 
-    SourceLocation AfterParenLoc;
+    SourceLocation FixItLoc;
     if (TypeSourceInfo *TSInfo = New->getTypeSourceInfo()) {
       TypeLoc TL = TSInfo->getTypeLoc().IgnoreParens();
       if (const FunctionTypeLoc *FTLoc = dyn_cast<FunctionTypeLoc>(&TL))
-        AfterParenLoc = PP.getLocForEndOfToken(FTLoc->getRParenLoc());
+        FixItLoc = PP.getLocForEndOfToken(FTLoc->getLocalRangeEnd());
     }
 
-    if (AfterParenLoc.isInvalid())
+    if (FixItLoc.isInvalid())
       Diag(New->getLocation(), diag::warn_missing_exception_specification)
         << New << OS.str();
     else {
@@ -209,7 +209,7 @@
       // late-specified return types.
       Diag(New->getLocation(), diag::warn_missing_exception_specification)
         << New << OS.str()
-        << FixItHint::CreateInsertion(AfterParenLoc, " " + OS.str().str());
+        << FixItHint::CreateInsertion(FixItLoc, " " + OS.str().str());
     }
 
     if (!Old->getLocation().isInvalid())

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Mar 12 05:17:06 2011
@@ -8866,8 +8866,8 @@
     // Check whether that explicit signature was synthesized by
     // GetTypeForDeclarator.  If so, don't save that as part of the
     // written signature.
-    if (ExplicitSignature.getLParenLoc() ==
-        ExplicitSignature.getRParenLoc()) {
+    if (ExplicitSignature.getLocalRangeBegin() ==
+        ExplicitSignature.getLocalRangeEnd()) {
       // This would be much cheaper if we stored TypeLocs instead of
       // TypeSourceInfos.
       TypeLoc Result = ExplicitSignature.getResultLoc();

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Sat Mar 12 05:17:06 2011
@@ -2466,8 +2466,8 @@
     }
     void VisitFunctionTypeLoc(FunctionTypeLoc TL) {
       assert(Chunk.Kind == DeclaratorChunk::Function);
-      TL.setLParenLoc(Chunk.Loc);
-      TL.setRParenLoc(Chunk.EndLoc);
+      TL.setLocalRangeBegin(Chunk.Loc);
+      TL.setLocalRangeEnd(Chunk.EndLoc);
       TL.setTrailingReturn(!!Chunk.Fun.TrailingReturnType);
 
       const DeclaratorChunk::FunctionTypeInfo &FTI = Chunk.Fun;

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Sat Mar 12 05:17:06 2011
@@ -3880,8 +3880,8 @@
   }
 
   FunctionProtoTypeLoc NewTL = TLB.push<FunctionProtoTypeLoc>(Result);
-  NewTL.setLParenLoc(TL.getLParenLoc());
-  NewTL.setRParenLoc(TL.getRParenLoc());
+  NewTL.setLocalRangeBegin(TL.getLocalRangeBegin());
+  NewTL.setLocalRangeEnd(TL.getLocalRangeEnd());
   NewTL.setTrailingReturn(TL.getTrailingReturn());
   for (unsigned i = 0, e = NewTL.getNumArgs(); i != e; ++i)
     NewTL.setArg(i, ParamDecls[i]);
@@ -3904,8 +3904,8 @@
     Result = getDerived().RebuildFunctionNoProtoType(ResultType);
 
   FunctionNoProtoTypeLoc NewTL = TLB.push<FunctionNoProtoTypeLoc>(Result);
-  NewTL.setLParenLoc(TL.getLParenLoc());
-  NewTL.setRParenLoc(TL.getRParenLoc());
+  NewTL.setLocalRangeBegin(TL.getLocalRangeBegin());
+  NewTL.setLocalRangeEnd(TL.getLocalRangeEnd());
   NewTL.setTrailingReturn(false);
 
   return Result;

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Sat Mar 12 05:17:06 2011
@@ -3443,8 +3443,8 @@
   TL.setNameLoc(ReadSourceLocation(Record, Idx));
 }
 void TypeLocReader::VisitFunctionTypeLoc(FunctionTypeLoc TL) {
-  TL.setLParenLoc(ReadSourceLocation(Record, Idx));
-  TL.setRParenLoc(ReadSourceLocation(Record, Idx));
+  TL.setLocalRangeBegin(ReadSourceLocation(Record, Idx));
+  TL.setLocalRangeEnd(ReadSourceLocation(Record, Idx));
   TL.setTrailingReturn(Record[Idx++]);
   for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) {
     TL.setArg(i, cast_or_null<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=127536&r1=127535&r2=127536&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Sat Mar 12 05:17:06 2011
@@ -451,8 +451,8 @@
   Writer.AddSourceLocation(TL.getNameLoc(), Record);
 }
 void TypeLocWriter::VisitFunctionTypeLoc(FunctionTypeLoc TL) {
-  Writer.AddSourceLocation(TL.getLParenLoc(), Record);
-  Writer.AddSourceLocation(TL.getRParenLoc(), Record);
+  Writer.AddSourceLocation(TL.getLocalRangeBegin(), Record);
+  Writer.AddSourceLocation(TL.getLocalRangeEnd(), Record);
   Record.push_back(TL.getTrailingReturn());
   for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i)
     Writer.AddDeclRef(TL.getArg(i), Record);





More information about the cfe-commits mailing list