aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/performance
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/performance
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/performance')
-rw-r--r--clang-tidy/performance/FasterStringFindCheck.cpp11
-rw-r--r--clang-tidy/performance/ForRangeCopyCheck.cpp2
-rw-r--r--clang-tidy/performance/ImplicitConversionInLoopCheck.cpp2
-rw-r--r--clang-tidy/performance/InefficientAlgorithmCheck.cpp4
-rw-r--r--clang-tidy/performance/InefficientVectorOperationCheck.cpp6
-rw-r--r--clang-tidy/performance/MoveConstArgCheck.cpp2
-rw-r--r--clang-tidy/performance/TypePromotionInMathFnCheck.cpp2
-rw-r--r--clang-tidy/performance/UnnecessaryValueParamCheck.cpp10
8 files changed, 20 insertions, 19 deletions
diff --git a/clang-tidy/performance/FasterStringFindCheck.cpp b/clang-tidy/performance/FasterStringFindCheck.cpp
index eddc52b6..71e5e408 100644
--- a/clang-tidy/performance/FasterStringFindCheck.cpp
+++ b/clang-tidy/performance/FasterStringFindCheck.cpp
@@ -90,13 +90,14 @@ void FasterStringFindCheck::check(const MatchFinder::MatchResult &Result) {
if (!Replacement)
return;
- diag(Literal->getLocStart(), "%0 called with a string literal consisting of "
+ diag(Literal->getBeginLoc(), "%0 called with a string literal consisting of "
"a single character; consider using the more "
"effective overload accepting a character")
- << FindFunc << FixItHint::CreateReplacement(
- CharSourceRange::getTokenRange(Literal->getLocStart(),
- Literal->getLocEnd()),
- *Replacement);
+ << FindFunc
+ << FixItHint::CreateReplacement(
+ CharSourceRange::getTokenRange(Literal->getBeginLoc(),
+ Literal->getLocEnd()),
+ *Replacement);
}
} // namespace performance
diff --git a/clang-tidy/performance/ForRangeCopyCheck.cpp b/clang-tidy/performance/ForRangeCopyCheck.cpp
index 2358aacb..c8c90638 100644
--- a/clang-tidy/performance/ForRangeCopyCheck.cpp
+++ b/clang-tidy/performance/ForRangeCopyCheck.cpp
@@ -41,7 +41,7 @@ void ForRangeCopyCheck::registerMatchers(MatchFinder *Finder) {
void ForRangeCopyCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Var = Result.Nodes.getNodeAs<VarDecl>("loopVar");
// Ignore code in macros since we can't place the fixes correctly.
- if (Var->getLocStart().isMacroID())
+ if (Var->getBeginLoc().isMacroID())
return;
if (handleConstValueCopy(*Var, *Result.Context))
return;
diff --git a/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp b/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp
index 1a5605f5..6e731190 100644
--- a/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp
+++ b/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp
@@ -96,7 +96,7 @@ void ImplicitConversionInLoopCheck::ReportAndFix(
"change the type to the matching one (%1 but 'const auto&' is always a "
"valid option) or remove the reference to make it explicit that you are "
"creating a new value";
- diag(VD->getLocStart(), Message) << VD << ConstRefType;
+ diag(VD->getBeginLoc(), Message) << VD << ConstRefType;
}
} // namespace performance
diff --git a/clang-tidy/performance/InefficientAlgorithmCheck.cpp b/clang-tidy/performance/InefficientAlgorithmCheck.cpp
index 4471d077..8cee2817 100644
--- a/clang-tidy/performance/InefficientAlgorithmCheck.cpp
+++ b/clang-tidy/performance/InefficientAlgorithmCheck.cpp
@@ -99,7 +99,7 @@ void InefficientAlgorithmCheck::check(const MatchFinder::MatchResult &Result) {
.getUnqualifiedType()
.getCanonicalType();
if (AlgCmp != ContainerCmp) {
- diag(Arg->getLocStart(),
+ diag(Arg->getBeginLoc(),
"different comparers used in the algorithm and the container");
return;
}
@@ -153,7 +153,7 @@ void InefficientAlgorithmCheck::check(const MatchFinder::MatchResult &Result) {
Hint = FixItHint::CreateReplacement(CallRange, ReplacementText);
}
- diag(AlgCall->getLocStart(),
+ diag(AlgCall->getBeginLoc(),
"this STL algorithm call should be replaced with a container method")
<< Hint;
}
diff --git a/clang-tidy/performance/InefficientVectorOperationCheck.cpp b/clang-tidy/performance/InefficientVectorOperationCheck.cpp
index 33c68f01..5b083761 100644
--- a/clang-tidy/performance/InefficientVectorOperationCheck.cpp
+++ b/clang-tidy/performance/InefficientVectorOperationCheck.cpp
@@ -168,7 +168,7 @@ void InefficientVectorOperationCheck::check(
// FIXME: make it more intelligent to identify the pre-allocating operations
// before the for loop.
if (SM.isBeforeInTranslationUnit(Ref->getLocation(),
- LoopStmt->getLocStart())) {
+ LoopStmt->getBeginLoc())) {
return;
}
}
@@ -200,13 +200,13 @@ void InefficientVectorOperationCheck::check(
}
auto Diag =
- diag(VectorAppendCall->getLocStart(),
+ diag(VectorAppendCall->getBeginLoc(),
"%0 is called inside a loop; "
"consider pre-allocating the vector capacity before the loop")
<< VectorAppendCall->getMethodDecl()->getDeclName();
if (!ReserveStmt.empty())
- Diag << FixItHint::CreateInsertion(LoopStmt->getLocStart(), ReserveStmt);
+ Diag << FixItHint::CreateInsertion(LoopStmt->getBeginLoc(), ReserveStmt);
}
} // namespace performance
diff --git a/clang-tidy/performance/MoveConstArgCheck.cpp b/clang-tidy/performance/MoveConstArgCheck.cpp
index 8d494802..c9c7be19 100644
--- a/clang-tidy/performance/MoveConstArgCheck.cpp
+++ b/clang-tidy/performance/MoveConstArgCheck.cpp
@@ -23,7 +23,7 @@ static void ReplaceCallWithArg(const CallExpr *Call, DiagnosticBuilder &Diag,
const Expr *Arg = Call->getArg(0);
CharSourceRange BeforeArgumentsRange = Lexer::makeFileCharRange(
- CharSourceRange::getCharRange(Call->getLocStart(), Arg->getLocStart()),
+ CharSourceRange::getCharRange(Call->getBeginLoc(), Arg->getBeginLoc()),
SM, LangOpts);
CharSourceRange AfterArgumentsRange = Lexer::makeFileCharRange(
CharSourceRange::getCharRange(Call->getLocEnd(),
diff --git a/clang-tidy/performance/TypePromotionInMathFnCheck.cpp b/clang-tidy/performance/TypePromotionInMathFnCheck.cpp
index 441bad38..8ff31a06 100644
--- a/clang-tidy/performance/TypePromotionInMathFnCheck.cpp
+++ b/clang-tidy/performance/TypePromotionInMathFnCheck.cpp
@@ -195,7 +195,7 @@ void TypePromotionInMathFnCheck::check(const MatchFinder::MatchResult &Result) {
// declared in <math.h>.
if (FnInCmath)
if (auto IncludeFixit = IncludeInserter->CreateIncludeInsertion(
- Result.Context->getSourceManager().getFileID(Call->getLocStart()),
+ Result.Context->getSourceManager().getFileID(Call->getBeginLoc()),
"cmath", /*IsAngled=*/true))
Diag << *IncludeFixit;
}
diff --git a/clang-tidy/performance/UnnecessaryValueParamCheck.cpp b/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
index 588a2982..8c9259c7 100644
--- a/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
+++ b/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
@@ -156,7 +156,7 @@ void UnnecessaryValueParamCheck::check(const MatchFinder::MatchResult &Result) {
// compilation unit as the signature change could introduce build errors.
// 4. the function is an explicit template specialization.
const auto *Method = llvm::dyn_cast<CXXMethodDecl>(Function);
- if (Param->getLocStart().isMacroID() || (Method && Method->isVirtual()) ||
+ if (Param->getBeginLoc().isMacroID() || (Method && Method->isVirtual()) ||
isReferencedOutsideOfCallExpr(*Function, *Result.Context) ||
isExplicitTemplateSpecialization(*Function))
return;
@@ -189,20 +189,20 @@ void UnnecessaryValueParamCheck::storeOptions(
void UnnecessaryValueParamCheck::handleMoveFix(const ParmVarDecl &Var,
const DeclRefExpr &CopyArgument,
const ASTContext &Context) {
- auto Diag = diag(CopyArgument.getLocStart(),
+ auto Diag = diag(CopyArgument.getBeginLoc(),
"parameter %0 is passed by value and only copied once; "
"consider moving it to avoid unnecessary copies")
<< &Var;
// Do not propose fixes in macros since we cannot place them correctly.
- if (CopyArgument.getLocStart().isMacroID())
+ if (CopyArgument.getBeginLoc().isMacroID())
return;
const auto &SM = Context.getSourceManager();
auto EndLoc = Lexer::getLocForEndOfToken(CopyArgument.getLocation(), 0, SM,
Context.getLangOpts());
- Diag << FixItHint::CreateInsertion(CopyArgument.getLocStart(), "std::move(")
+ Diag << FixItHint::CreateInsertion(CopyArgument.getBeginLoc(), "std::move(")
<< FixItHint::CreateInsertion(EndLoc, ")");
if (auto IncludeFixit = Inserter->CreateIncludeInsertion(
- SM.getFileID(CopyArgument.getLocStart()), "utility",
+ SM.getFileID(CopyArgument.getBeginLoc()), "utility",
/*IsAngled=*/true))
Diag << *IncludeFixit;
}