diff options
author | Shuai Wang <shuaiwang@google.com> | 2018-09-11 22:59:46 +0000 |
---|---|---|
committer | Shuai Wang <shuaiwang@google.com> | 2018-09-11 22:59:46 +0000 |
commit | a7e338194a11580a32506b8d596862b7b19fe4b7 (patch) | |
tree | 08c64d65eeb573abcd070f0e4ec43d0257c2afe9 /clang-tidy/performance | |
parent | af5e2eb00b3fade1850328cedb82266133911951 (diff) |
[clangtidy] Remove old copy of ExprMutationAnalyzer
Summary:
This is 2/2 of moving ExprMutationAnalyzer from clangtidy to clang/Analysis.
ExprMutationAnalyzer is moved to clang/Analysis in D51948.
This diff migrates existing usages within clangtidy to point to the new
location and remove the old copy of ExprMutationAnalyzer.
Reviewers: george.karpenkov, JonasToth
Reviewed By: george.karpenkov
Subscribers: mgorny, a.sidorin, Szelethus, cfe-commits
Differential Revision: https://reviews.llvm.org/D51950
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@342006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/performance')
-rw-r--r-- | clang-tidy/performance/ForRangeCopyCheck.cpp | 5 | ||||
-rw-r--r-- | clang-tidy/performance/UnnecessaryValueParamCheck.cpp | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/clang-tidy/performance/ForRangeCopyCheck.cpp b/clang-tidy/performance/ForRangeCopyCheck.cpp index 0a3cc4f6..d60a2f34 100644 --- a/clang-tidy/performance/ForRangeCopyCheck.cpp +++ b/clang-tidy/performance/ForRangeCopyCheck.cpp @@ -9,9 +9,9 @@ #include "ForRangeCopyCheck.h" #include "../utils/DeclRefExprUtils.h" -#include "../utils/ExprMutationAnalyzer.h" #include "../utils/FixItHintUtils.h" #include "../utils/TypeTraits.h" +#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h" using namespace clang::ast_matchers; @@ -88,8 +88,7 @@ bool ForRangeCopyCheck::handleCopyIsOnlyConstReferenced( // Because the fix (changing to `const auto &`) will introduce an unused // compiler warning which can't be suppressed. // Since this case is very rare, it is safe to ignore it. - if (!utils::ExprMutationAnalyzer(*ForRange.getBody(), Context) - .isMutated(&LoopVar) && + if (!ExprMutationAnalyzer(*ForRange.getBody(), Context).isMutated(&LoopVar) && !utils::decl_ref_expr::allDeclRefExprs(LoopVar, *ForRange.getBody(), Context) .empty()) { diff --git a/clang-tidy/performance/UnnecessaryValueParamCheck.cpp b/clang-tidy/performance/UnnecessaryValueParamCheck.cpp index 63b853de..29a8b84c 100644 --- a/clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ b/clang-tidy/performance/UnnecessaryValueParamCheck.cpp @@ -10,10 +10,10 @@ #include "UnnecessaryValueParamCheck.h" #include "../utils/DeclRefExprUtils.h" -#include "../utils/ExprMutationAnalyzer.h" #include "../utils/FixItHintUtils.h" #include "../utils/Matchers.h" #include "../utils/TypeTraits.h" +#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Lex/Lexer.h" #include "clang/Lex/Preprocessor.h" @@ -95,14 +95,14 @@ void UnnecessaryValueParamCheck::check(const MatchFinder::MatchResult &Result) { // Do not trigger on non-const value parameters when they are mutated either // within the function body or within init expression(s) when the function is // a ctor. - if (utils::ExprMutationAnalyzer(*Function->getBody(), *Result.Context) + if (ExprMutationAnalyzer(*Function->getBody(), *Result.Context) .isMutated(Param)) return; // CXXCtorInitializer might also mutate Param but they're not part of function // body, so check them separately here. if (const auto *Ctor = dyn_cast<CXXConstructorDecl>(Function)) { for (const auto *Init : Ctor->inits()) { - if (utils::ExprMutationAnalyzer(*Init->getInit(), *Result.Context) + if (ExprMutationAnalyzer(*Init->getInit(), *Result.Context) .isMutated(Param)) return; } |