[PATCH] D67445: [yaml2obj/ObjectYAML] - Cleanup the error reporting API, add custom errors handlers.
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 07:34:31 PDT 2019
sbc100 added inline comments.
================
Comment at: include/llvm/ObjectYAML/yaml2obj.h:49
-Error convertYAML(Input &YIn, raw_ostream &Out, unsigned DocNum = 1);
+bool yaml2coff(COFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
+bool yaml2elf(ELFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
----------------
It seems like there is a separate change here which is to convert a lot of return codes from "int -> 0 for success" to "bool -> 1 for success". Is that objectively better? Is there an llvm policy for which is preferred? Could this change be more precise if that part was split out?
================
Comment at: lib/ObjectYAML/yaml2obj.cpp:21
-Error convertYAML(yaml::Input &YIn, raw_ostream &Out, unsigned DocNum) {
- // TODO: make yaml2* functions return Error instead of int.
- auto IntToErr = [](int Ret) -> Error {
- if (Ret)
- return createStringError(errc::invalid_argument, "yaml2obj failed");
- return Error::success();
- };
+static void defaultErrorHandler(const Twine &Msg) {
+ WithColor::error() << Msg << "\n";
----------------
I don't see this function referenced anywhere.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67445/new/
https://reviews.llvm.org/D67445
More information about the llvm-commits
mailing list