[Lldb-commits] [PATCH] D101236: [ASTImporter] Import definitions required for layout of [[no_unique_address]] from LLDB
Jan Kratochvil via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon May 24 12:45:25 PDT 2021
jankratochvil added a comment.
cat >1.cpp <<EOH
template <typename T> struct DWrapper {};
typedef DWrapper<void> DW;
struct B {
DW spd;
} b;
struct E {
B &b_ref = b;
static DW f() { return {}; }
} e;
EOH
$ (set -ex;./bin/clang -c -o 1.o 1.cpp -Wall -g;./bin/lldb -b ./1.o -o 'p E' -o 'p e')
(lldb) p E
(lldb) p e
lldb: .../clang/lib/AST/Decl.cpp:4188: bool clang::FieldDecl::isZeroSize(const clang::ASTContext &) const: Assertion `isInvalidDecl() && "valid field has incomplete type"' failed.
So importing just the type `E` is insufficient but I somehow cannot import the variable `e`:
auto *FromE = FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("e")));
...
// ASTTests: .../llvm/include/llvm/Support/Casting.h:269: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = clang::DeclContext, Y = clang::Decl]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
llvm::Error Err = findFromTU(FromE)->Importer->ImportDefinition(FromE);
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101236/new/
https://reviews.llvm.org/D101236
More information about the lldb-commits
mailing list