[all-commits] [llvm/llvm-project] a5fb2e: [lldb] Complete return types of CXXMethodDecls to ...
Raphael Isemann via All-commits
all-commits at lists.llvm.org
Wed Jan 29 00:09:06 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: a5fb2e371ec2b585ca56cbc1a116912aabe347d3
https://github.com/llvm/llvm-project/commit/a5fb2e371ec2b585ca56cbc1a116912aabe347d3
Author: Raphael Isemann <teemperor at gmail.com>
Date: 2020-01-29 (Wed, 29 Jan 2020)
Changed paths:
A lldb/packages/Python/lldbsuite/test/lang/cpp/covariant-return-types/Makefile
A lldb/packages/Python/lldbsuite/test/lang/cpp/covariant-return-types/TestCovariantReturnTypes.py
A lldb/packages/Python/lldbsuite/test/lang/cpp/covariant-return-types/main.cpp
M lldb/source/Symbol/ClangASTImporter.cpp
Log Message:
-----------
[lldb] Complete return types of CXXMethodDecls to prevent crashing due to covariant return types
Summary:
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
Reviewers: lhames, shafik
Reviewed By: shafik
Subscribers: abidh, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73024
More information about the All-commits
mailing list