diff options
author | Eric Liu <ioeric@google.com> | 2016-07-11 13:53:21 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2016-07-11 13:53:21 +0000 |
commit | a452db4d0ffa4cf6c2a861ef5806f30caebe2bf9 (patch) | |
tree | edcff3cce2c241736b3b329e45b5d3dc21bd742a /clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h | |
parent | 4f8d99433da80161f85988052f96bc7dc621c4eb (diff) | |
download | bcm5719-llvm-a452db4d0ffa4cf6c2a861ef5806f30caebe2bf9.tar.gz bcm5719-llvm-a452db4d0ffa4cf6c2a861ef5806f30caebe2bf9.zip |
Changes related to tooling::applyAllReplacements interface change in D21601.
Summary:
this patch contains changes related to the interface change from
http://reviews.llvm.org/D21601. Only submit this patch after D21601 is
submitted.
Reviewers: djasper, klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D21602
llvm-svn: 275063
Diffstat (limited to 'clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h')
-rw-r--r-- | clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h b/clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h index 0cbd955278f..b9725469199 100644 --- a/clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h +++ b/clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h @@ -17,6 +17,7 @@ #include "clang/Frontend/FrontendActions.h" #include "clang/Tooling/Refactoring.h" #include "clang/Tooling/Tooling.h" +#include "llvm/ADT/Optional.h" #include <map> #include <memory> @@ -121,7 +122,13 @@ runCheckOnCode(StringRef Code, std::vector<ClangTidyError> *Errors = nullptr, Fixes.insert(Error.Fix.begin(), Error.Fix.end()); if (Errors) *Errors = Context.getErrors(); - return tooling::applyAllReplacements(Code, Fixes); + auto Result = tooling::applyAllReplacements(Code, Fixes); + if (!Result) { + // FIXME: propogate the error. + llvm::consumeError(Result.takeError()); + return ""; + } + return *Result; } #define EXPECT_NO_CHANGES(Check, Code) \ |