[Lldb-commits] [PATCH] D70721: [lldb/cpluspluslanguage] Add constructor substitutor

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 26 08:49:05 PST 2019


labath created this revision.
labath added reviewers: teemperor, JDevlieghere.
Herald added a project: LLDB.

This patch adds code which will substitute references to the full object
constructors/destructors with their base object versions.

Like all substitutions in this category, this operation is not really
sound, but doing this in a more precise way allows us to get rid of a
much larger hack -- matching function according to their demangled
names, which effectively does the same thing, but also much more.

This is a (very late) follow-up to D54074 <https://reviews.llvm.org/D54074>.

Background: clang has an optimization which can eliminate full object
structors completely, if they are found to be equivalent to their base
object versions. It does this because it assumes they can be regenerated
on demand in the compile unit that needs them (e.g., because they are
declared inline). However, this doesn't work for the debugging scenario,
where we don't have the structor bodies available -- we pretend all
constructors are defined out-of-line as far as clang is concerned. This
causes clang to emit references to the (nonexisting) full object
structors during expression evaluation.

Fun fact: This is not a problem on darwin, because the relevant
optimization is disabled to work around a linker bug.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70721

Files:
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70721.231081.patch
Type: text/x-patch
Size: 5751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191126/e145277f/attachment.bin>


More information about the lldb-commits mailing list