[PATCH] D61015: [LibTooling] Change Transformer's TextGenerator to a partial function.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 30 06:51:40 PDT 2019


ymandel marked 4 inline comments as done.
ymandel added inline comments.


================
Comment at: clang/lib/Tooling/Refactoring/Transformer.cpp:164
       return SmallVector<Transformation, 0>();
-    T.Replacement = Edit.Replacement(Result);
+    auto ReplacementOrErr = Edit.Replacement(Result);
+    if (auto Err = ReplacementOrErr.takeError())
----------------
ilya-biryukov wrote:
> Maybe follow a typical pattern for handling errors here (to avoid  `OrErr` suffixes and an extra `Err` variable)? I.e.
> ```
> auto Replacement = Edit.Replacement(Result);
> if (!Replacement)
>   return Replacement.takeError();
> T.Replacement = std::move(*Replacement);
> ```
> 
Here and elsewhere.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61015/new/

https://reviews.llvm.org/D61015





More information about the cfe-commits mailing list