[all-commits] [llvm/llvm-project] c16f0b: [lldb/cpluspluslanguage] Add constructor substitutor

Pavel Labath via All-commits all-commits at lists.llvm.org
Thu Dec 5 03:43:50 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c16f0b18c13e88fedaa510bc2442bb693a6230c8
      https://github.com/llvm/llvm-project/commit/c16f0b18c13e88fedaa510bc2442bb693a6230c8
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2019-12-05 (Thu, 05 Dec 2019)

  Changed paths:
    M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
    M lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

  Log Message:
  -----------
  [lldb/cpluspluslanguage] Add constructor substitutor

Summary:
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.

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.

Reviewers: teemperor, JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70721




More information about the All-commits mailing list