[PATCH] D117879: [demangler][NFC] Refactor some parsing

Nathan Sidwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 23 06:23:50 PST 2022


urnathan added inline comments.


================
Comment at: libcxxabi/src/demangle/ItaniumDemangle.h:2671-2673
+  bool IsStd = consumeIf("St");
+  if (IsStd)
+    consumeIf('L');
----------------
ChuanqiXu wrote:
> This looks equal to:
> ```
> bool IsStd = consumeIf("St") || consumeIf('L');
> ```
It turns out the original logic gets in the way of some later nonNFC changes I want to make.


================
Comment at: llvm/include/llvm/Demangle/StringView.h:45-49
+    size_t FindBegin = std::min(From, size());
     // Avoid calling memchr with nullptr.
-    if (From < size()) {
+    if (FindBegin < size()) {
       // Just forward to memchr, which is faster than a hand-rolled loop.
+      if (const void *P = ::memchr(First + FindBegin, C, size() - FindBegin))
----------------
ChuanqiXu wrote:
> I thought the original logic is simpler.
This change surprised me -- I did not intentionally make it.  These files in llvm/include/llvm/Demangle are synced from libcxxabi/src/demangle via that director's cp-to-llvm.sh script, which I applied.  It seems that commit 1f9e18b6565fd1bb69c4b649b9efd3467b3c7c7d
Author: serge-sans-paille <sguelton at redhat.com>
Date:   Thu Jan 20 11:21:47 2022 +0100

    [llvm] Remove (some) LLVMDemangle header dependencies

just jumped in between my recent resync and this diff.  Paging Serge!?


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

https://reviews.llvm.org/D117879



More information about the llvm-commits mailing list