[PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected<string> instead of empty string to indicate potential error.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 24 06:37:47 PDT 2016

ioeric marked 2 inline comments as done.

Comment at: unittests/Format/CleanupTest.cpp:258
@@ +257,3 @@
+    auto CleanReplaces = cleanupAroundReplacements(Code, Replaces, Style);
+    EXPECT_TRUE((bool)CleanReplaces)
+        << llvm::toString(CleanReplaces.takeError()) << "\n";
klimek wrote:
> The explicit cast is unfortunate. Does this not have an .Ok() method or something?
unfortunately, the bool operator is the only way we got...

I think the idea is that Errors are always expected to be checked and handled (the destructor of llvm::Error asserts that an Error has been handled).


More information about the cfe-commits mailing list