[PATCH] D41997: Build virtual override tables in DWARFASTParserClang::CompleteTypeFromDWARF

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 09:40:46 PST 2018


lhames created this revision.
lhames added a reviewer: davide.
lhames added a project: LLDB.
Herald added subscribers: llvm-commits, JDevlieghere.

Failure to build the method override tables results in expression failures on the following trivial test case:

  class Base {
  public:
    virtual ~Base() {}
    virtual void foo() {}
  };
  
  class Derived : public Base {
  public:
    virtual void foo() {}
  };
  
  int main() {
    Derived d;
    Base *b = &d;
    return 0; // "expr b->foo()" ok. "expr d.foo()" crashes. 
  }

The reason is that without an overrides table, the definition of foo in derived is treated as a new method definition (rather than an override) and allocated its own vtable entry which does not exist in the vtable of Derived in the compiled program.


Repository:
  rL LLVM

https://reviews.llvm.org/D41997

Files:
  Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  Python/lldbsuite/test/expression_command/call-overridden-method/Makefile
  Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py
  Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41997.129646.patch
Type: text/x-patch
Size: 7093 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180112/75a2dedb/attachment.bin>


More information about the llvm-commits mailing list