[PATCH] D105014: added some example code for llvm::Expected<T>
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 30 01:39:10 PDT 2021
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.
Thanks!
================
Comment at: llvm/include/llvm/Support/Error.h:464
+/// errs() << "Problem with division "
+/// << toString(E) << "\n";
+/// }
----------------
this won't compile, you need std::move(E)
================
Comment at: llvm/include/llvm/Support/Error.h:467
+/// // use the result
+/// outs() << "The answer is " << *Result << "\n";
+/// @endcode
----------------
this will crash in the error case, you need to `return` after the errs() log
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105014/new/
https://reviews.llvm.org/D105014
More information about the cfe-commits
mailing list