[PATCH] D81905: Enhance Itanium demangler interface.

Konstantin Bobrovsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 16:44:04 PDT 2020


kbobrovs updated this revision to Diff 272860.
kbobrovs added a comment.

Had to add few more fixes to get my code including ItanumDemangler.h compiled. Plus returning NodeArray by const ref is more efficient.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81905

Files:
  llvm/include/llvm/Demangle/ItaniumDemangle.h


Index: llvm/include/llvm/Demangle/ItaniumDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -462,6 +462,8 @@
            static_cast<const NameType *>(Ty)->getName() == "objc_object";
   }
 
+  const StringView& getProtocol() const { return Protocol; }
+
   void printLeft(OutputStream &S) const override {
     Ty->print(S);
     S += "<";
@@ -497,7 +499,7 @@
     } else {
       const auto *objcProto = static_cast<const ObjCProtoName *>(Pointee);
       s += "id<";
-      s += objcProto->Protocol;
+      s += objcProto->getProtocol();
       s += ">";
     }
   }
@@ -1199,7 +1201,7 @@
 
   template<typename Fn> void match(Fn F) const { F(Params); }
 
-  NodeArray getParams() { return Params; }
+  const NodeArray& getParams() const { return Params; }
 
   void printLeft(OutputStream &S) const override {
     S += "<";
@@ -2057,6 +2059,9 @@
     else
       S << Integer;
   }
+
+  // Retrieves the string view of the integer value this node represents.
+  const StringView &getIntegerValue() const { return Integer; }
 };
 
 class IntegerLiteral : public Node {
@@ -2085,6 +2090,13 @@
     if (Type.size() <= 3)
       S += Type;
   }
+
+  // Retrieves the string view of the integer value represented by this node.
+  const StringView &getValue() const { return Value; }
+
+  // Retrieves the string view of the type string of the integer value this node
+  // represents.
+  const StringView &getType() const { return Type; }
 };
 
 template <class Float> struct FloatData;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81905.272860.patch
Type: text/x-patch
Size: 1616 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200623/46df4230/attachment.bin>


More information about the llvm-commits mailing list