[Lldb-commits] [PATCH] D73024: [lldb] Complete return types of CXXMethodDecls to prevent crashing due to covariant return types

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 20 03:21:22 PST 2020

teemperor created this revision.
teemperor added reviewers: lhames, shafik.
Herald added subscribers: lldb-commits, JDevlieghere, abidh.
Herald added a project: LLDB.

Currently we crash in Clang's CodeGen when we call functions with covariant return types with this assert:

  Assertion failed: (DD && "queried property of class with no definition"), function data, file clang/include/clang/AST/DeclCXX.h, line 433.

when calling `clang::CXXRecordDecl::isDerivedFrom` from the `ItaniumVTableBuilder`.

Clang seems to assume that the underlying record decls of covariant return types are already completed.
This is true during a normal Clang invocation as there the type checker will complete both decls when
checking if the overloaded function is valid (i.e., the return types are covariant).

When we minimally import our AST into the expression in LLDB we don't do this type checking (which
would complete the record decls) and we end up trying to access the invalid record decls from CodeGen
which makes us trigger the assert.

This patch just completes the underlying types of ptr/ref return types of virtual function so that the
underlying records are complete and we behave as Clang expects us to do.

Fixes rdar://38048657




-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73024.239045.patch
Type: text/x-patch
Size: 6578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200120/e4fc1e82/attachment.bin>

More information about the lldb-commits mailing list