[PATCH] D139298: WIP: Add error handling to demangle API

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 10 15:54:18 PST 2023


dblaikie added a comment.

Could make the error_code out parameter optional (take by pointer, populate if non-null, have a null default parameter value) - then callers who don't benefit from/care about the specific type can continue using the null pointer result signal?



================
Comment at: llvm/lib/ProfileData/ItaniumManglingCanonicalizer.cpp:290-296
+  std::error_code E;
   if (Mangling.startswith("_Z") || Mangling.startswith("__Z") ||
       Mangling.startswith("___Z") || Mangling.startswith("____Z"))
-    N = Demangler.parse();
+    N = Demangler.parse(E);
   else
     N = Demangler.make<itanium_demangle::NameType>(
         StringView(Mangling.data(), Mangling.size()));
----------------
This could be changed to parse, check the error and then do the `make<NameType>(StringView` thing if the parse failed as invalid, maybe? (potentially in a follow-up commit)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139298



More information about the llvm-commits mailing list