diff options
author | Eric Liu <ioeric@google.com> | 2016-07-11 13:53:12 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2016-07-11 13:53:12 +0000 |
commit | a45abc6b0f06d0cf90d0c595bc6ea37596cd5802 (patch) | |
tree | 0d6b81fd2ea5a11ce527046160d9f0d29cab6a92 /unittests/Format/FormatTestProto.cpp | |
parent | 481ab3b5eba4f2ef26b3d3f9cab4b48ea00632ca (diff) | |
download | clang-a45abc6b0f06d0cf90d0c595bc6ea37596cd5802.tar.gz |
Make tooling::applyAllReplacements return llvm::Expected<string> instead of empty string to indicate potential error.
Summary:
return llvm::Expected<> to carry error status and error information.
This is the first step towards introducing "Error" into tooling::Replacements.
Reviewers: djasper, klimek
Subscribers: ioeric, klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D21601
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275062 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTestProto.cpp')
-rw-r--r-- | unittests/Format/FormatTestProto.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/unittests/Format/FormatTestProto.cpp b/unittests/Format/FormatTestProto.cpp index d9fb140913..6881af4361 100644 --- a/unittests/Format/FormatTestProto.cpp +++ b/unittests/Format/FormatTestProto.cpp @@ -25,10 +25,10 @@ protected: DEBUG(llvm::errs() << Code << "\n\n"); std::vector<tooling::Range> Ranges(1, tooling::Range(Offset, Length)); tooling::Replacements Replaces = reformat(Style, Code, Ranges); - std::string Result = applyAllReplacements(Code, Replaces); - EXPECT_NE("", Result); - DEBUG(llvm::errs() << "\n" << Result << "\n\n"); - return Result; + auto Result = applyAllReplacements(Code, Replaces); + EXPECT_TRUE(static_cast<bool>(Result)); + DEBUG(llvm::errs() << "\n" << *Result << "\n\n"); + return *Result; } static std::string format(llvm::StringRef Code) { |