aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/readability
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2018-08-09 22:42:26 +0000
committerStephen Kelly <steveire@gmail.com>2018-08-09 22:42:26 +0000
commit4cacbf2c444f87871805c14748142cd9d92ff716 (patch)
treecd29442ae42c99a6b607b64eec72d705cda151ef /clang-tidy/readability
parent0a2b7a8dca76ba0f8fc24ebc81461ab6bc0d89fd (diff)
Port getLocStart -> getBeginLoc
Reviewers: javed.absar Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50354 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@339400 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/readability')
-rw-r--r--clang-tidy/readability/AvoidConstParamsInDecls.cpp6
-rw-r--r--clang-tidy/readability/BracesAroundStatementsCheck.cpp4
-rw-r--r--clang-tidy/readability/ContainerSizeEmptyCheck.cpp4
-rw-r--r--clang-tidy/readability/DeleteNullPointerCheck.cpp4
-rw-r--r--clang-tidy/readability/DeletedDefaultCheck.cpp4
-rw-r--r--clang-tidy/readability/FunctionSizeCheck.cpp6
-rw-r--r--clang-tidy/readability/IdentifierNamingCheck.cpp2
-rw-r--r--clang-tidy/readability/ImplicitBoolConversionCheck.cpp16
-rw-r--r--clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp2
-rw-r--r--clang-tidy/readability/MisleadingIndentationCheck.cpp6
-rw-r--r--clang-tidy/readability/MisplacedArrayIndexCheck.cpp2
-rw-r--r--clang-tidy/readability/NamedParameterCheck.cpp4
-rw-r--r--clang-tidy/readability/NamespaceCommentCheck.cpp4
-rw-r--r--clang-tidy/readability/NonConstParameterCheck.cpp2
-rw-r--r--clang-tidy/readability/RedundantDeclarationCheck.cpp2
-rw-r--r--clang-tidy/readability/RedundantSmartptrGetCheck.cpp2
-rw-r--r--clang-tidy/readability/RedundantStringCStrCheck.cpp2
-rw-r--r--clang-tidy/readability/SimplifyBooleanExprCheck.cpp22
-rw-r--r--clang-tidy/readability/SimplifySubscriptExprCheck.cpp2
-rw-r--r--clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp4
-rw-r--r--clang-tidy/readability/StringCompareCheck.cpp6
-rw-r--r--clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp6
22 files changed, 56 insertions, 56 deletions
diff --git a/clang-tidy/readability/AvoidConstParamsInDecls.cpp b/clang-tidy/readability/AvoidConstParamsInDecls.cpp
index 70329e83..8b221881 100644
--- a/clang-tidy/readability/AvoidConstParamsInDecls.cpp
+++ b/clang-tidy/readability/AvoidConstParamsInDecls.cpp
@@ -22,7 +22,7 @@ namespace {
SourceRange getTypeRange(const ParmVarDecl &Param) {
if (Param.getIdentifier() != nullptr)
- return SourceRange(Param.getLocStart(),
+ return SourceRange(Param.getBeginLoc(),
Param.getLocEnd().getLocWithOffset(-1));
return Param.getSourceRange();
}
@@ -82,7 +82,7 @@ void AvoidConstParamsInDecls::check(const MatchFinder::MatchResult &Result) {
if (!Param->getType().isLocalConstQualified())
return;
- auto Diag = diag(Param->getLocStart(),
+ auto Diag = diag(Param->getBeginLoc(),
"parameter %0 is const-qualified in the function "
"declaration; const-qualification of parameters only has an "
"effect in function definitions");
@@ -97,7 +97,7 @@ void AvoidConstParamsInDecls::check(const MatchFinder::MatchResult &Result) {
Diag << Param;
}
- if (Param->getLocStart().isMacroID() != Param->getLocEnd().isMacroID()) {
+ if (Param->getBeginLoc().isMacroID() != Param->getLocEnd().isMacroID()) {
// Do not offer a suggestion if the part of the variable declaration comes
// from a macro.
return;
diff --git a/clang-tidy/readability/BracesAroundStatementsCheck.cpp b/clang-tidy/readability/BracesAroundStatementsCheck.cpp
index 1bff668d..a29e68a3 100644
--- a/clang-tidy/readability/BracesAroundStatementsCheck.cpp
+++ b/clang-tidy/readability/BracesAroundStatementsCheck.cpp
@@ -174,7 +174,7 @@ BracesAroundStatementsCheck::findRParenLoc(const IfOrWhileStmt *S,
const SourceManager &SM,
const ASTContext *Context) {
// Skip macros.
- if (S->getLocStart().isMacroID())
+ if (S->getBeginLoc().isMacroID())
return SourceLocation();
SourceLocation CondEndLoc = S->getCond()->getLocEnd();
@@ -232,7 +232,7 @@ bool BracesAroundStatementsCheck::checkStmt(
// level as the start of the statement. We also need file locations for
// Lexer::getLocForEndOfToken working properly.
InitialLoc = Lexer::makeFileCharRange(
- CharSourceRange::getCharRange(InitialLoc, S->getLocStart()),
+ CharSourceRange::getCharRange(InitialLoc, S->getBeginLoc()),
SM, Context->getLangOpts())
.getBegin();
if (InitialLoc.isInvalid())
diff --git a/clang-tidy/readability/ContainerSizeEmptyCheck.cpp b/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
index 5604354f..60a153a8 100644
--- a/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
+++ b/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
@@ -201,12 +201,12 @@ void ContainerSizeEmptyCheck::check(const MatchFinder::MatchResult &Result) {
}
if (MemberCall) {
- diag(MemberCall->getLocStart(),
+ diag(MemberCall->getBeginLoc(),
"the 'empty' method should be used to check "
"for emptiness instead of 'size'")
<< Hint;
} else {
- diag(BinCmp->getLocStart(),
+ diag(BinCmp->getBeginLoc(),
"the 'empty' method should be used to check "
"for emptiness instead of comparing to an empty object")
<< Hint;
diff --git a/clang-tidy/readability/DeleteNullPointerCheck.cpp b/clang-tidy/readability/DeleteNullPointerCheck.cpp
index 766dfdac..4d3188c4 100644
--- a/clang-tidy/readability/DeleteNullPointerCheck.cpp
+++ b/clang-tidy/readability/DeleteNullPointerCheck.cpp
@@ -55,14 +55,14 @@ void DeleteNullPointerCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Compound = Result.Nodes.getNodeAs<CompoundStmt>("compound");
auto Diag = diag(
- IfWithDelete->getLocStart(),
+ IfWithDelete->getBeginLoc(),
"'if' statement is unnecessary; deleting null pointer has no effect");
if (IfWithDelete->getElse())
return;
// FIXME: generate fixit for this case.
Diag << FixItHint::CreateRemoval(CharSourceRange::getTokenRange(
- IfWithDelete->getLocStart(),
+ IfWithDelete->getBeginLoc(),
Lexer::getLocForEndOfToken(IfWithDelete->getCond()->getLocEnd(), 0,
*Result.SourceManager,
Result.Context->getLangOpts())));
diff --git a/clang-tidy/readability/DeletedDefaultCheck.cpp b/clang-tidy/readability/DeletedDefaultCheck.cpp
index a197e8dc..e99ca837 100644
--- a/clang-tidy/readability/DeletedDefaultCheck.cpp
+++ b/clang-tidy/readability/DeletedDefaultCheck.cpp
@@ -41,7 +41,7 @@ void DeletedDefaultCheck::check(const MatchFinder::MatchResult &Result) {
"either be removed or explicitly deleted";
if (const auto *Constructor =
Result.Nodes.getNodeAs<CXXConstructorDecl>("constructor")) {
- auto Diag = diag(Constructor->getLocStart(), Message);
+ auto Diag = diag(Constructor->getBeginLoc(), Message);
if (Constructor->isDefaultConstructor()) {
Diag << "default constructor"
<< "a non-static data member or a base class is lacking a default "
@@ -56,7 +56,7 @@ void DeletedDefaultCheck::check(const MatchFinder::MatchResult &Result) {
}
} else if (const auto *Assignment =
Result.Nodes.getNodeAs<CXXMethodDecl>("method-decl")) {
- diag(Assignment->getLocStart(), Message)
+ diag(Assignment->getBeginLoc(), Message)
<< (Assignment->isCopyAssignmentOperator() ? "copy assignment operator"
: "move assignment operator")
<< "a base class or a non-static data member is not assignable, e.g. "
diff --git a/clang-tidy/readability/FunctionSizeCheck.cpp b/clang-tidy/readability/FunctionSizeCheck.cpp
index 8ed6b907..b1ceea11 100644
--- a/clang-tidy/readability/FunctionSizeCheck.cpp
+++ b/clang-tidy/readability/FunctionSizeCheck.cpp
@@ -73,7 +73,7 @@ public:
// is already nested NestingThreshold levels deep, record the start location
// of this new compound statement.
if (CurrentNestingLevel == Info.NestingThreshold)
- Info.NestingThresholders.push_back(Node->getLocStart());
+ Info.NestingThresholders.push_back(Node->getBeginLoc());
++CurrentNestingLevel;
Base::TraverseCompoundStmt(Node);
@@ -162,9 +162,9 @@ void FunctionSizeCheck::check(const MatchFinder::MatchResult &Result) {
// Count the lines including whitespace and comments. Really simple.
if (const Stmt *Body = Func->getBody()) {
SourceManager *SM = Result.SourceManager;
- if (SM->isWrittenInSameFile(Body->getLocStart(), Body->getLocEnd())) {
+ if (SM->isWrittenInSameFile(Body->getBeginLoc(), Body->getLocEnd())) {
FI.Lines = SM->getSpellingLineNumber(Body->getLocEnd()) -
- SM->getSpellingLineNumber(Body->getLocStart());
+ SM->getSpellingLineNumber(Body->getBeginLoc());
}
}
diff --git a/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tidy/readability/IdentifierNamingCheck.cpp
index 46919d3f..90c34b37 100644
--- a/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -841,7 +841,7 @@ void IdentifierNamingCheck::check(const MatchFinder::MatchResult &Result) {
if (StringRef(Fixup).equals(Name)) {
if (!IgnoreFailedSplit) {
LLVM_DEBUG(llvm::dbgs()
- << Decl->getLocStart().printToString(*Result.SourceManager)
+ << Decl->getBeginLoc().printToString(*Result.SourceManager)
<< llvm::format(": unable to split words for %s '%s'\n",
KindName.c_str(), Name.str().c_str()));
}
diff --git a/clang-tidy/readability/ImplicitBoolConversionCheck.cpp b/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
index 79022d42..2a449ff6 100644
--- a/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
+++ b/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
@@ -24,14 +24,14 @@ namespace {
AST_MATCHER(Stmt, isMacroExpansion) {
SourceManager &SM = Finder->getASTContext().getSourceManager();
- SourceLocation Loc = Node.getLocStart();
+ SourceLocation Loc = Node.getBeginLoc();
return SM.isMacroBodyExpansion(Loc) || SM.isMacroArgExpansion(Loc);
}
bool isNULLMacroExpansion(const Stmt *Statement, ASTContext &Context) {
SourceManager &SM = Context.getSourceManager();
const LangOptions &LO = Context.getLangOpts();
- SourceLocation Loc = Statement->getLocStart();
+ SourceLocation Loc = Statement->getBeginLoc();
return SM.isMacroBodyExpansion(Loc) &&
Lexer::getImmediateMacroName(Loc, SM, LO) == "NULL";
}
@@ -97,9 +97,9 @@ void fixGenericExprCastToBool(DiagnosticBuilder &Diag,
bool InvertComparison =
Parent != nullptr && isUnaryLogicalNotOperator(Parent);
if (InvertComparison) {
- SourceLocation ParentStartLoc = Parent->getLocStart();
+ SourceLocation ParentStartLoc = Parent->getBeginLoc();
SourceLocation ParentEndLoc =
- cast<UnaryOperator>(Parent)->getSubExpr()->getLocStart();
+ cast<UnaryOperator>(Parent)->getSubExpr()->getBeginLoc();
Diag << FixItHint::CreateRemoval(
CharSourceRange::getCharRange(ParentStartLoc, ParentEndLoc));
@@ -122,7 +122,7 @@ void fixGenericExprCastToBool(DiagnosticBuilder &Diag,
}
if (!StartLocInsertion.empty()) {
- Diag << FixItHint::CreateInsertion(Cast->getLocStart(), StartLocInsertion);
+ Diag << FixItHint::CreateInsertion(Cast->getBeginLoc(), StartLocInsertion);
}
std::string EndLocInsertion;
@@ -183,7 +183,7 @@ void fixGenericExprCastFromBool(DiagnosticBuilder &Diag,
bool NeedParens = !isa<ParenExpr>(SubExpr);
Diag << FixItHint::CreateInsertion(
- Cast->getLocStart(),
+ Cast->getBeginLoc(),
(Twine("static_cast<") + OtherType + ">" + (NeedParens ? "(" : ""))
.str());
@@ -354,7 +354,7 @@ void ImplicitBoolConversionCheck::handleCastToBool(const ImplicitCastExpr *Cast,
return;
}
- auto Diag = diag(Cast->getLocStart(), "implicit conversion %0 -> bool")
+ auto Diag = diag(Cast->getBeginLoc(), "implicit conversion %0 -> bool")
<< Cast->getSubExpr()->getType();
StringRef EquivalentLiteral =
@@ -371,7 +371,7 @@ void ImplicitBoolConversionCheck::handleCastFromBool(
ASTContext &Context) {
QualType DestType =
NextImplicitCast ? NextImplicitCast->getType() : Cast->getType();
- auto Diag = diag(Cast->getLocStart(), "implicit conversion bool -> %0")
+ auto Diag = diag(Cast->getBeginLoc(), "implicit conversion bool -> %0")
<< DestType;
if (const auto *BoolLiteral =
diff --git a/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp b/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
index f1d0036c..280c354f 100644
--- a/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
+++ b/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
@@ -324,7 +324,7 @@ void InconsistentDeclarationParameterNameCheck::check(
return;
}
- SourceLocation StartLoc = OriginalDeclaration->getLocStart();
+ SourceLocation StartLoc = OriginalDeclaration->getBeginLoc();
if (StartLoc.isMacroID() && IgnoreMacros) {
markRedeclarationsAsVisited(OriginalDeclaration);
return;
diff --git a/clang-tidy/readability/MisleadingIndentationCheck.cpp b/clang-tidy/readability/MisleadingIndentationCheck.cpp
index 8a6c8c47..5abace50 100644
--- a/clang-tidy/readability/MisleadingIndentationCheck.cpp
+++ b/clang-tidy/readability/MisleadingIndentationCheck.cpp
@@ -79,15 +79,15 @@ void MisleadingIndentationCheck::missingBracesCheck(const SourceManager &SM,
if (isa<CompoundStmt>(Inner))
continue;
- SourceLocation InnerLoc = Inner->getLocStart();
- SourceLocation OuterLoc = CurrentStmt->getLocStart();
+ SourceLocation InnerLoc = Inner->getBeginLoc();
+ SourceLocation OuterLoc = CurrentStmt->getBeginLoc();
if (SM.getExpansionLineNumber(InnerLoc) ==
SM.getExpansionLineNumber(OuterLoc))
continue;
const Stmt *NextStmt = CStmt->body_begin()[i + 1];
- SourceLocation NextLoc = NextStmt->getLocStart();
+ SourceLocation NextLoc = NextStmt->getBeginLoc();
if (InnerLoc.isMacroID() || OuterLoc.isMacroID() || NextLoc.isMacroID())
continue;
diff --git a/clang-tidy/readability/MisplacedArrayIndexCheck.cpp b/clang-tidy/readability/MisplacedArrayIndexCheck.cpp
index f5e09fab..3d1971be 100644
--- a/clang-tidy/readability/MisplacedArrayIndexCheck.cpp
+++ b/clang-tidy/readability/MisplacedArrayIndexCheck.cpp
@@ -30,7 +30,7 @@ void MisplacedArrayIndexCheck::check(const MatchFinder::MatchResult &Result) {
const auto *ArraySubscriptE =
Result.Nodes.getNodeAs<ArraySubscriptExpr>("expr");
- auto Diag = diag(ArraySubscriptE->getLocStart(), "confusing array subscript "
+ auto Diag = diag(ArraySubscriptE->getBeginLoc(), "confusing array subscript "
"expression, usually the "
"index is inside the []");
diff --git a/clang-tidy/readability/NamedParameterCheck.cpp b/clang-tidy/readability/NamedParameterCheck.cpp
index ffdc813b..6fa9e68f 100644
--- a/clang-tidy/readability/NamedParameterCheck.cpp
+++ b/clang-tidy/readability/NamedParameterCheck.cpp
@@ -59,7 +59,7 @@ void NamedParameterCheck::check(const MatchFinder::MatchResult &Result) {
// Sanity check the source locations.
if (!Parm->getLocation().isValid() || Parm->getLocation().isMacroID() ||
- !SM.isWrittenInSameFile(Parm->getLocStart(), Parm->getLocation()))
+ !SM.isWrittenInSameFile(Parm->getBeginLoc(), Parm->getLocation()))
continue;
// Skip gmock testing::Unused parameters.
@@ -73,7 +73,7 @@ void NamedParameterCheck::check(const MatchFinder::MatchResult &Result) {
// Look for comments. We explicitly want to allow idioms like
// void foo(int /*unused*/)
- const char *Begin = SM.getCharacterData(Parm->getLocStart());
+ const char *Begin = SM.getCharacterData(Parm->getBeginLoc());
const char *End = SM.getCharacterData(Parm->getLocation());
StringRef Data(Begin, End - Begin);
if (Data.find("/*") != StringRef::npos)
diff --git a/clang-tidy/readability/NamespaceCommentCheck.cpp b/clang-tidy/readability/NamespaceCommentCheck.cpp
index 409aba90..229cc626 100644
--- a/clang-tidy/readability/NamespaceCommentCheck.cpp
+++ b/clang-tidy/readability/NamespaceCommentCheck.cpp
@@ -69,12 +69,12 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) {
const auto *ND = Result.Nodes.getNodeAs<NamespaceDecl>("namespace");
const SourceManager &Sources = *Result.SourceManager;
- if (!locationsInSameFile(Sources, ND->getLocStart(), ND->getRBraceLoc()))
+ if (!locationsInSameFile(Sources, ND->getBeginLoc(), ND->getRBraceLoc()))
return;
// Don't require closing comments for namespaces spanning less than certain
// number of lines.
- unsigned StartLine = Sources.getSpellingLineNumber(ND->getLocStart());
+ unsigned StartLine = Sources.getSpellingLineNumber(ND->getBeginLoc());
unsigned EndLine = Sources.getSpellingLineNumber(ND->getRBraceLoc());
if (EndLine - StartLine + 1 <= ShortNamespaceLines)
return;
diff --git a/clang-tidy/readability/NonConstParameterCheck.cpp b/clang-tidy/readability/NonConstParameterCheck.cpp
index bc6507c8..e33191cf 100644
--- a/clang-tidy/readability/NonConstParameterCheck.cpp
+++ b/clang-tidy/readability/NonConstParameterCheck.cpp
@@ -146,7 +146,7 @@ void NonConstParameterCheck::diagnoseNonConstParameters() {
unsigned Index = Par->getFunctionScopeIndex();
for (FunctionDecl *FnDecl : Function->redecls())
Fixes.push_back(FixItHint::CreateInsertion(
- FnDecl->getParamDecl(Index)->getLocStart(), "const "));
+ FnDecl->getParamDecl(Index)->getBeginLoc(), "const "));
diag(Par->getLocation(), "pointer parameter '%0' can be pointer to const")
<< Par->getName() << Fixes;
diff --git a/clang-tidy/readability/RedundantDeclarationCheck.cpp b/clang-tidy/readability/RedundantDeclarationCheck.cpp
index 1df3f055..c5b6cc32 100644
--- a/clang-tidy/readability/RedundantDeclarationCheck.cpp
+++ b/clang-tidy/readability/RedundantDeclarationCheck.cpp
@@ -59,7 +59,7 @@ void RedundantDeclarationCheck::check(const MatchFinder::MatchResult &Result) {
if (const auto *VD = dyn_cast<VarDecl>(D)) {
// Is this a multivariable declaration?
for (const auto Other : VD->getDeclContext()->decls()) {
- if (Other != D && Other->getLocStart() == VD->getLocStart()) {
+ if (Other != D && Other->getBeginLoc() == VD->getBeginLoc()) {
MultiVar = true;
break;
}
diff --git a/clang-tidy/readability/RedundantSmartptrGetCheck.cpp b/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
index 1abd70bd..b03b546f 100644
--- a/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
+++ b/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
@@ -138,7 +138,7 @@ void RedundantSmartptrGetCheck::check(const MatchFinder::MatchResult &Result) {
*Result.SourceManager, getLangOpts());
// Replace foo->get() with *foo, and foo.get() with foo.
std::string Replacement = Twine(IsPtrToPtr ? "*" : "", SmartptrText).str();
- diag(GetCall->getLocStart(), "redundant get() call on smart pointer")
+ diag(GetCall->getBeginLoc(), "redundant get() call on smart pointer")
<< FixItHint::CreateReplacement(GetCall->getSourceRange(), Replacement);
}
diff --git a/clang-tidy/readability/RedundantStringCStrCheck.cpp b/clang-tidy/readability/RedundantStringCStrCheck.cpp
index 21f4a8a5..f0c378f5 100644
--- a/clang-tidy/readability/RedundantStringCStrCheck.cpp
+++ b/clang-tidy/readability/RedundantStringCStrCheck.cpp
@@ -189,7 +189,7 @@ void RedundantStringCStrCheck::check(const MatchFinder::MatchResult &Result) {
if (ArgText.empty())
return;
- diag(Call->getLocStart(), "redundant call to %0")
+ diag(Call->getBeginLoc(), "redundant call to %0")
<< Member->getMemberDecl()
<< FixItHint::CreateReplacement(Call->getSourceRange(), ArgText);
}
diff --git a/clang-tidy/readability/SimplifyBooleanExprCheck.cpp b/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
index ba8e5b42..97243a9d 100644
--- a/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
+++ b/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
@@ -62,7 +62,7 @@ const char SimplifyConditionalReturnDiagnostic[] =
const CXXBoolLiteralExpr *getBoolLiteral(const MatchFinder::MatchResult &Result,
StringRef Id) {
const auto *Literal = Result.Nodes.getNodeAs<CXXBoolLiteralExpr>(Id);
- return (Literal && Literal->getLocStart().isMacroID()) ? nullptr : Literal;
+ return (Literal && Literal->getBeginLoc().isMacroID()) ? nullptr : Literal;
}
internal::Matcher<Stmt> returnsBool(bool Value, StringRef Id = "ignored") {
@@ -372,7 +372,7 @@ void SimplifyBooleanExprCheck::reportBinOp(
else
return;
- if (Bool->getLocStart().isMacroID())
+ if (Bool->getBeginLoc().isMacroID())
return;
// FIXME: why do we need this?
@@ -385,8 +385,8 @@ void SimplifyBooleanExprCheck::reportBinOp(
const Expr *ReplaceWith, bool Negated) {
std::string Replacement =
replacementExpression(Result, Negated, ReplaceWith);
- SourceRange Range(LHS->getLocStart(), RHS->getLocEnd());
- issueDiag(Result, Bool->getLocStart(), SimplifyOperatorDiagnostic, Range,
+ SourceRange Range(LHS->getBeginLoc(), RHS->getLocEnd());
+ issueDiag(Result, Bool->getBeginLoc(), SimplifyOperatorDiagnostic, Range,
Replacement);
};
@@ -577,7 +577,7 @@ void SimplifyBooleanExprCheck::replaceWithThenStatement(
const MatchFinder::MatchResult &Result,
const CXXBoolLiteralExpr *TrueConditionRemoved) {
const auto *IfStatement = Result.Nodes.getNodeAs<IfStmt>(IfStmtId);
- issueDiag(Result, TrueConditionRemoved->getLocStart(),
+ issueDiag(Result, TrueConditionRemoved->getBeginLoc(),
SimplifyConditionDiagnostic, IfStatement->getSourceRange(),
getText(Result, *IfStatement->getThen()));
}
@@ -587,7 +587,7 @@ void SimplifyBooleanExprCheck::replaceWithElseStatement(
const CXXBoolLiteralExpr *FalseConditionRemoved) {
const auto *IfStatement = Result.Nodes.getNodeAs<IfStmt>(IfStmtId);
const Stmt *ElseStatement = IfStatement->getElse();
- issueDiag(Result, FalseConditionRemoved->getLocStart(),
+ issueDiag(Result, FalseConditionRemoved->getBeginLoc(),
SimplifyConditionDiagnostic, IfStatement->getSourceRange(),
ElseStatement ? getText(Result, *ElseStatement) : "");
}
@@ -597,7 +597,7 @@ void SimplifyBooleanExprCheck::replaceWithCondition(
bool Negated) {
std::string Replacement =
replacementExpression(Result, Negated, Ternary->getCond());
- issueDiag(Result, Ternary->getTrueExpr()->getLocStart(),
+ issueDiag(Result, Ternary->getTrueExpr()->getBeginLoc(),
"redundant boolean literal in ternary expression result",
Ternary->getSourceRange(), Replacement);
}
@@ -608,7 +608,7 @@ void SimplifyBooleanExprCheck::replaceWithReturnCondition(
std::string Condition = replacementExpression(Result, Negated, If->getCond());
std::string Replacement = ("return " + Condition + Terminator).str();
SourceLocation Start =
- Result.Nodes.getNodeAs<CXXBoolLiteralExpr>(ThenLiteralId)->getLocStart();
+ Result.Nodes.getNodeAs<CXXBoolLiteralExpr>(ThenLiteralId)->getBeginLoc();
issueDiag(Result, Start, SimplifyConditionalReturnDiagnostic,
If->getSourceRange(), Replacement);
}
@@ -640,8 +640,8 @@ void SimplifyBooleanExprCheck::replaceCompoundReturnWithCondition(
std::string Replacement =
"return " + replacementExpression(Result, Negated, Condition);
issueDiag(
- Result, Lit->getLocStart(), SimplifyConditionalReturnDiagnostic,
- SourceRange(If->getLocStart(), Ret->getLocEnd()), Replacement);
+ Result, Lit->getBeginLoc(), SimplifyConditionalReturnDiagnostic,
+ SourceRange(If->getBeginLoc(), Ret->getLocEnd()), Replacement);
return;
}
@@ -665,7 +665,7 @@ void SimplifyBooleanExprCheck::replaceWithAssignment(
std::string Replacement =
(VariableName + " = " + Condition + Terminator).str();
SourceLocation Location =
- Result.Nodes.getNodeAs<CXXBoolLiteralExpr>(IfAssignLocId)->getLocStart();
+ Result.Nodes.getNodeAs<CXXBoolLiteralExpr>(IfAssignLocId)->getBeginLoc();
issueDiag(Result, Location,
"redundant boolean literal in conditional assignment", Range,
Replacement);
diff --git a/clang-tidy/readability/SimplifySubscriptExprCheck.cpp b/clang-tidy/readability/SimplifySubscriptExprCheck.cpp
index 28cc576d..036489f3 100644
--- a/clang-tidy/readability/SimplifySubscriptExprCheck.cpp
+++ b/clang-tidy/readability/SimplifySubscriptExprCheck.cpp
@@ -60,7 +60,7 @@ void SimplifySubscriptExprCheck::check(const MatchFinder::MatchResult &Result) {
"accessing an element of the container does not require a call to "
"'data()'; did you mean to use 'operator[]'?");
if (Member->isArrow())
- DiagBuilder << FixItHint::CreateInsertion(Member->getLocStart(), "(*")
+ DiagBuilder << FixItHint::CreateInsertion(Member->getBeginLoc(), "(*")
<< FixItHint::CreateInsertion(Member->getOperatorLoc(), ")");
DiagBuilder << FixItHint::CreateRemoval(
{Member->getOperatorLoc(), Call->getLocEnd()});
diff --git a/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp b/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
index b1365772..92d78796 100644
--- a/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
+++ b/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
@@ -51,7 +51,7 @@ void StaticAccessedThroughInstanceCheck::check(
const auto *MemberExpression =
Result.Nodes.getNodeAs<MemberExpr>("memberExpression");
- if (MemberExpression->getLocStart().isMacroID())
+ if (MemberExpression->getBeginLoc().isMacroID())
return;
const Expr *BaseExpr = MemberExpression->getBase();
@@ -71,7 +71,7 @@ void StaticAccessedThroughInstanceCheck::check(
std::string BaseTypeName =
BaseType.getAsString(PrintingPolicyWithSupressedTag);
- SourceLocation MemberExprStartLoc = MemberExpression->getLocStart();
+ SourceLocation MemberExprStartLoc = MemberExpression->getBeginLoc();
auto Diag =
diag(MemberExprStartLoc, "static member accessed through instance");
diff --git a/clang-tidy/readability/StringCompareCheck.cpp b/clang-tidy/readability/StringCompareCheck.cpp
index e75e80bb..38ac43f2 100644
--- a/clang-tidy/readability/StringCompareCheck.cpp
+++ b/clang-tidy/readability/StringCompareCheck.cpp
@@ -51,7 +51,7 @@ void StringCompareCheck::registerMatchers(MatchFinder *Finder) {
void StringCompareCheck::check(const MatchFinder::MatchResult &Result) {
if (const auto *Matched = Result.Nodes.getNodeAs<Stmt>("match1")) {
- diag(Matched->getLocStart(), CompareMessage);
+ diag(Matched->getBeginLoc(), CompareMessage);
return;
}
@@ -63,10 +63,10 @@ void StringCompareCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Str2 = Result.Nodes.getNodeAs<Stmt>("str2");
const auto *Compare = Result.Nodes.getNodeAs<Stmt>("compare");
- auto Diag = diag(Matched->getLocStart(), CompareMessage);
+ auto Diag = diag(Matched->getBeginLoc(), CompareMessage);
if (Str1->isArrow())
- Diag << FixItHint::CreateInsertion(Str1->getLocStart(), "*");
+ Diag << FixItHint::CreateInsertion(Str1->getBeginLoc(), "*");
Diag << tooling::fixit::createReplacement(*Zero, *Str2, Ctx)
<< tooling::fixit::createReplacement(*Compare, *Str1->getBase(),
diff --git a/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp b/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
index 3ad346cd..4476f370 100644
--- a/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
+++ b/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
@@ -42,7 +42,7 @@ void UniqueptrDeleteReleaseCheck::check(
const auto *PtrExpr = Result.Nodes.getNodeAs<Expr>("uptr");
const auto *DeleteExpr = Result.Nodes.getNodeAs<Expr>("delete");
- if (PtrExpr->getLocStart().isMacroID())
+ if (PtrExpr->getBeginLoc().isMacroID())
return;
// Ignore dependent types.
@@ -54,11 +54,11 @@ void UniqueptrDeleteReleaseCheck::check(
SourceLocation AfterPtr = Lexer::getLocForEndOfToken(
PtrExpr->getLocEnd(), 0, *Result.SourceManager, getLangOpts());
- diag(DeleteExpr->getLocStart(),
+ diag(DeleteExpr->getBeginLoc(),
"prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> "
"objects")
<< FixItHint::CreateRemoval(CharSourceRange::getCharRange(
- DeleteExpr->getLocStart(), PtrExpr->getLocStart()))
+ DeleteExpr->getBeginLoc(), PtrExpr->getBeginLoc()))
<< FixItHint::CreateReplacement(
CharSourceRange::getTokenRange(AfterPtr, DeleteExpr->getLocEnd()),
" = nullptr");