diff options
author | Haojian Wu <hokein@google.com> | 2016-03-02 09:01:25 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2016-03-02 09:01:25 +0000 |
commit | 1b5b0fd174b28ae4e51433f104daa0057cea5c89 (patch) | |
tree | d09f0e9d1054a680b0d262b0f8d7566e26444e95 /clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp | |
parent | e92ab2fbd324b8c3480534d866589e64ce2a9d29 (diff) | |
download | bcm5719-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.cpp | 11 |
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 |