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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 14 11:09:21 PDT 2018


ruiu added inline comments.


================
Comment at: libcxxabi/src/demangle/Utility.h:173
 
+inline bool initializeOutputStream(char *Buf, size_t *N, OutputStream &S,
+                                   size_t InitSize) {
----------------
erik.pilkington wrote:
> ruiu wrote:
> > Looks like there are two patterns how to use this function -- one way is to pass `nullptr, nullptr` as first two arguments, and the other is to pass an actual buffer. Can you separate that as two functions?
> > 
> > It looks like the latter use case is used only once, so you might be able to inline it.
> There are actually many uses in the LLVM version, see llvm/lib/Demangle/ItaniumDemangle.cpp. Personally, I like it as a single function that encapsulates the buffer initialization for __cxa_demangle. I agree its a bit awkward, but thats just the API that it's trying to implement.
Oh okay, never mind. If this function is being used in many places, it isn't worth to fix all caller places anyway.


================
Comment at: libcxxabi/src/demangle/Utility.h:179
+    if (Buf == nullptr)
+      return true;
+    BufferSize = InitSize;
----------------
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.


https://reviews.llvm.org/D52104





More information about the llvm-commits mailing list