From 8a96663a7a13c86cbfaa9a7abafc6b3497d966e0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 9 Aug 2018 20:05:18 +0000 Subject: [PATCH] Add getBeginLoc API to replace getStartLoc Reviewers: teemperor! Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50347 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339373 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/ExprCXX.h | 4 ++-- include/clang/AST/Stmt.h | 2 +- include/clang/Analysis/CloneDetection.h | 3 ++- lib/CodeGen/CoverageMappingGen.cpp | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index 86899b34ee..89ae5f1fdf 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -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) { diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 26e47f00a7..0b78de9bcc 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -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; } diff --git a/include/clang/Analysis/CloneDetection.h b/include/clang/Analysis/CloneDetection.h index 915ec58a51..b3fb447b1e 100644 --- a/include/clang/Analysis/CloneDetection.h +++ b/include/clang/Analysis/CloneDetection.h @@ -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. /// diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp index 2d84464635..389d29e467 100644 --- a/lib/CodeGen/CoverageMappingGen.cpp +++ b/lib/CodeGen/CoverageMappingGen.cpp @@ -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; } -- 2.50.1