summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2016-03-02 09:01:25 +0000
committerHaojian Wu <hokein@google.com>2016-03-02 09:01:25 +0000
commit1b5b0fd174b28ae4e51433f104daa0057cea5c89 (patch)
treed09f0e9d1054a680b0d262b0f8d7566e26444e95 /clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
parente92ab2fbd324b8c3480534d866589e64ce2a9d29 (diff)
downloadbcm5719-llvm-1b5b0fd174b28ae4e51433f104daa0057cea5c89.tar.gz
bcm5719-llvm-1b5b0fd174b28ae4e51433f104daa0057cea5c89.zip
[clang-tidy] Make 'modernize-pass-by-value' fix work on header files.
Reviewers: alexfh Subscribers: jbcoe, cfe-commits Differential Revision: http://reviews.llvm.org/D17756 llvm-svn: 262470
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
index 02ec4b2d1c7..20bd7811bd4 100644
--- a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
@@ -208,11 +208,12 @@ void PassByValueCheck::check(const MatchFinder::MatchResult &Result) {
<< FixItHint::CreateInsertion(
Initializer->getLParenLoc().getLocWithOffset(1), "std::move(");
- auto Insertion =
- Inserter->CreateIncludeInsertion(SM.getMainFileID(), "utility",
- /*IsAngled=*/true);
- if (Insertion.hasValue())
- Diag << Insertion.getValue();
+ if (auto IncludeFixit = Inserter->CreateIncludeInsertion(
+ Result.SourceManager->getFileID(Initializer->getSourceLocation()),
+ "utility",
+ /*IsAngled=*/true)) {
+ Diag << *IncludeFixit;
+ }
}
} // namespace modernize
OpenPOWER on IntegriCloud