[Lldb-commits] [PATCH] D54053: [NativePDB] Add the ability to create clang record decls from mangled names.

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 2 15:01:19 PDT 2018


zturner created this revision.
zturner added reviewers: aleksandr.urakov, labath, lemo.
Herald added subscribers: erik.pilkington, mgorny.

Previously we were not able to accurately represent tag record types with clang record decls.  The primary reason for this is that for type information PDB only contains fully instantiated type names.  It does not contain rich information about namespaces, declaration contexts (e.g. parent classes, function scopes for local classes, etc), template parameters, or anything else.  All you have is a big long string that is a fully instantiated type name.  What it does give you, however, is the mangled name of this type.  So we can extract all of the relevant information (minus the distinction between outer class and outer namespace) from the mangled name.  This patch is the start of this effort.

It uses LLVM's demangler to demangle the name, and treat each component as one component of a namespace chain.

Obviously this is not true in the general case, as something like `Foo<int>::Bar(double)::`1'::LocalClass<7>::NestedClass` will get treated as if it were in a series of namespaces.  However, it's a good start, and clang doesn't actually care for most uses.  So we can improve on this incrementally with subsequent patches to make this more accurate.


https://reviews.llvm.org/D54053

Files:
  lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/NativePDB/MangledAST.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/MangledAST.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54053.172442.patch
Type: text/x-patch
Size: 10836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181102/9f1bf905/attachment.bin>


More information about the lldb-commits mailing list