diff options
author | Stephen Kelly <steveire@gmail.com> | 2018-08-09 22:42:26 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2018-08-09 22:42:26 +0000 |
commit | 43465bf3fd6cca715187ee7286c881cb210fc3c4 (patch) | |
tree | c2aad6e9cadd0b7164c476722704660c4b84b5e5 /clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp | |
parent | d54b7f059290102b0ff007843ecf0668e833c118 (diff) | |
download | llvm-43465bf3fd6cca715187ee7286c881cb210fc3c4.zip llvm-43465bf3fd6cca715187ee7286c881cb210fc3c4.tar.gz llvm-43465bf3fd6cca715187ee7286c881cb210fc3c4.tar.bz2 |
Port getLocStart -> getBeginLoc
Reviewers: javed.absar
Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D50354
llvm-svn: 339400
Diffstat (limited to 'clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp b/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp index 588a298..8c9259c 100644 --- a/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ b/clang-tools-extra/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; } |