[Lldb-commits] [PATCH] D105215: [lldb] Remove CPlusPlusLanguage from Mangled

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 28 12:37:28 PDT 2021


bulbazord added a comment.

Thanks for the reviews and comments! It's kind of unfortunate that LLDB is like this right now but I believe this patch is a step in the right direction. :)



================
Comment at: lldb/source/Core/Mangled.cpp:322
   if (preference == ePreferDemangledWithoutArguments) {
-    return GetDemangledNameWithoutArguments(m_mangled, demangled);
+    if (Language *lang = Language::FindPlugin(GuessLanguage())) {
+      return lang->GetDemangledFunctionNameWithoutArguments(*this);
----------------
clayborg wrote:
> bulbazord wrote:
> > clayborg wrote:
> > > Maybe we should make a Language::FindPlugin(...) that like:
> > > ```
> > > Language *Language::FindPlugin(Mangled::ManglingScheme mangling_scheme);
> > > ```
> > > Should be easy to add since this change is kind of about refactoring and putting the code into plug-ins. It is essentially what "lldb::LanguageType Mangled::GuessLanguage() const" is doing. That code could be moved to where Language::FindPlugin(...) lives.
> > `GuessLanguage` has a bunch of uses outside of `Mangled` itself, so I think that would make more sense if we performed other refactors first.
> > 
> > I don't think putting this into another `Language::FindPlugin` function is a good idea because (as I understand it) mangling schemes aren't specific to languages. 
> We _are_ using GuessLanguage to guess the language and we are using a language specific plug-in to do the work. So effectively it is the same thing.
> 
> I wonder if GetName(...) should take an extra Language parameter? If a lldb_private::Function wants the name as , then we _do_ know the language, then it could send the language in for it to be more correct. Itanium name mangling can mangle different languages right? Is there any way to differentiate correctly without actually knowing the language?
Right, I understand. *Ideally* we wouldn't be doing that, but...

What you're suggesting might be better in the long run (using language information where available) but unfortunately I think that's far from where we are at currently. As for itanium name mangling, I don't think you can reliably determine the language the symbol came from unfortunately. Some languages have their own name mangling scheme luckily, so it may be easier for some languages.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105215



More information about the lldb-commits mailing list