[PATCH] D52104: lld-link: print demangled symbol names for "undefined symbol" diagnostics

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 14 11:40:54 PDT 2018


thakis added a comment.

Thanks!



================
Comment at: libcxxabi/src/demangle/Utility.h:179
+    if (Buf == nullptr)
+      return true;
+    BufferSize = InitSize;
----------------
ruiu wrote:
> Perhaps off-topic, but I'd perhaps call std::terminate() instead of returning true for memory exhaustion error, as we can't really handle such error situation in most cases.
This code is identical in lib/Demangle and in libcxxabi. In libcxxabi this is used to implement __cxa_demangle 
which commands that an error code is returned on allocation failure: https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.3/a01696.html

I agree that regular client software can't do anything useful on oom, but this is dictated by an external api contract.


================
Comment at: lld/COFF/SymbolTable.cpp:84-86
   if (!Candidate)
-    return "";
-  return Candidate->getName();
+    return nullptr;
+  return Candidate;
----------------
ruiu wrote:
> You can just return Candidate.
Err, yes :-D Done.


https://reviews.llvm.org/D52104





More information about the llvm-commits mailing list