Add getBeginLoc API to replace getStartLoc
authorStephen Kelly <steveire@gmail.com>
Thu, 9 Aug 2018 20:05:18 +0000 (20:05 +0000)
committerStephen Kelly <steveire@gmail.com>
Thu, 9 Aug 2018 20:05:18 +0000 (20:05 +0000)
Reviewers: teemperor!

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D50347

llvm-svn: 339373

clang/include/clang/AST/ExprCXX.h
clang/include/clang/AST/Stmt.h
clang/include/clang/Analysis/CloneDetection.h
clang/lib/CodeGen/CoverageMappingGen.cpp

index 86899b3..89ae5f1 100644 (file)
@@ -2094,7 +2094,8 @@ public:
     return SubExprs + Array + hasInitializer() + getNumPlacementArgs();
   }
 
-  SourceLocation getStartLoc() const { return Range.getBegin(); }
+  SourceLocation getStartLoc() const LLVM_READONLY { return getBeginLoc(); }
+  SourceLocation getBeginLoc() const { return Range.getBegin(); }
   SourceLocation getEndLoc() const { return Range.getEnd(); }
 
   SourceRange getDirectInitRange() const { return DirectInitRange; }
@@ -2104,7 +2105,6 @@ public:
   }
 
   SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
-  SourceLocation getBeginLoc() const LLVM_READONLY { return getStartLoc(); }
   SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
 
   static bool classof(const Stmt *T) {
index 26e47f0..0b78de9 100644 (file)
@@ -523,7 +523,7 @@ public:
   DeclGroupRef getDeclGroup() { return DG; }
   void setDeclGroup(DeclGroupRef DGR) { DG = DGR; }
 
-  SourceLocation getStartLoc() const { return StartLoc; }
+  SourceLocation getStartLoc() const LLVM_READONLY { return getBeginLoc(); }
   void setStartLoc(SourceLocation L) { StartLoc = L; }
   SourceLocation getEndLoc() const { return EndLoc; }
   void setEndLoc(SourceLocation L) { EndLoc = L; }
index 915ec58..b3fb447 100644 (file)
@@ -122,7 +122,8 @@ public:
   /// Returns the start sourcelocation of the first statement in this sequence.
   ///
   /// This method should only be called on a non-empty StmtSequence object.
-  SourceLocation getStartLoc() const;
+  SourceLocation getStartLoc() const LLVM_READONLY { return getBeginLoc(); }
+  SourceLocation getBeginLoc() const;
 
   /// Returns the end sourcelocation of the last statement in this sequence.
   ///
index 2d84464..389d29e 100644 (file)
@@ -67,7 +67,8 @@ public:
 
   void setStartLoc(SourceLocation Loc) { LocStart = Loc; }
 
-  SourceLocation getStartLoc() const {
+  SourceLocation getStartLoc() const LLVM_READONLY { return getBeginLoc(); }
+  SourceLocation getBeginLoc() const {
     assert(LocStart && "Region has no start location");
     return *LocStart;
   }