[libcxxabi] r339580 - [itanium demangler] Add llvm::itaniumFindTypesInMangledName()

Erik Pilkington via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 13 09:37:47 PDT 2018


Author: epilk
Date: Mon Aug 13 09:37:47 2018
New Revision: 339580

URL: http://llvm.org/viewvc/llvm-project?rev=339580&view=rev
Log:
[itanium demangler] Add llvm::itaniumFindTypesInMangledName()

This function calls a callback whenever a <type> is parsed.

This is necessary to implement FindAlternateFunctionManglings in LLDB, which
uses a similar hack in FastDemangle. Once that function has been updated to use
this version, FastDemangle can finally be removed.

Differential revision: https://reviews.llvm.org/D50586

Modified:
    libcxxabi/trunk/src/cxa_demangle.cpp

Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=339580&r1=339579&r2=339580&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Mon Aug 13 09:37:47 2018
@@ -1976,6 +1976,9 @@ struct Db {
   // conversion operator's type, and are resolved in the enclosing <encoding>.
   PODSmallVector<ForwardTemplateReference *, 4> ForwardTemplateRefs;
 
+  void (*TypeCallback)(void *, const char *) = nullptr;
+  void *TypeCallbackContext = nullptr;
+
   bool TryToParseTemplateArgs = true;
   bool PermitForwardTemplateReferences = false;
   bool ParsingLambdaParams = false;
@@ -3218,6 +3221,9 @@ Node *Db::parseQualifiedType() {
 Node *Db::parseType() {
   Node *Result = nullptr;
 
+  if (TypeCallback != nullptr)
+    TypeCallback(TypeCallbackContext, First);
+
   switch (look()) {
   //             ::= <qualified-type>
   case 'r':




More information about the cfe-commits mailing list