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

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 21 13:02:28 PST 2022


aaron.ballman added inline comments.


================
Comment at: libcxxabi/src/demangle/ItaniumDemangle.h:2591-2594
+  if (look() == 'N') {
+    Result = getDerived().parseNestedName(State);
+  } else if (look() == 'Z') {
+    Result = getDerived().parseLocalName(State);
----------------
Personally, I think the early returns are a bit easier to follow along with. WDYT?


================
Comment at: libcxxabi/src/demangle/ItaniumDemangle.h:2622
+    } else if (IsSubst) {
+      // The substitution case must be followed by template-args
       return nullptr;
----------------



================
Comment at: libcxxabi/src/demangle/ItaniumDemangle.h:4077
   case 'S': {
-    if (look(1) && look(1) != 't') {
-      Node *Sub = getDerived().parseSubstitution();
-      if (Sub == nullptr)
+    if (look(1) != 't') {
+      Result = getDerived().parseSubstitution();
----------------
Was this change NFC, or did we drop a needed check for `\0` because there is nothing to lookahead to?


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

https://reviews.llvm.org/D117879



More information about the llvm-commits mailing list