Skip to content

Commit f6865f7

Browse files
author
git apple-llvm automerger
committed
Merge commit 'c261de724b01' from llvm.org/release/19.x into stable/20240723
2 parents ba38f8e + c261de7 commit f6865f7

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,15 @@ static void PrepareContextToReceiveMembers(TypeSystemClang &ast,
290290
}
291291

292292
// We don't have a type definition and/or the import failed, but we need to
293-
// add members to it. Start the definition to make that possible.
294-
tag_decl_ctx->startDefinition();
293+
// add members to it. Start the definition to make that possible. If the type
294+
// has no external storage we also have to complete the definition. Otherwise,
295+
// that will happen when we are asked to complete the type
296+
// (CompleteTypeFromDWARF).
297+
ast.StartTagDeclarationDefinition(type);
298+
if (!tag_decl_ctx->hasExternalLexicalStorage()) {
299+
ast.SetDeclIsForcefullyCompleted(tag_decl_ctx);
300+
ast.CompleteTagDeclarationDefinition(type);
301+
}
295302
}
296303

297304
void DWARFASTParserClang::RegisterDIE(DWARFDebugInfoEntry *die,
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %clangxx --target=x86_64-pc-linux -flimit-debug-info -o %t -c %s -g
2+
// RUN: %lldb %t -o "target var a" -o "expr -- var" -o exit | FileCheck %s
3+
4+
// This forces lldb to attempt to complete the type A. Since it has no
5+
// definition it will fail.
6+
// CHECK: target var a
7+
// CHECK: (A) a = <incomplete type "A">
8+
9+
// Now attempt to display the second variable, which will try to add a typedef
10+
// to the incomplete type. Make sure that succeeds. Use the expression command
11+
// to make sure the resulting AST can be imported correctly.
12+
// CHECK: expr -- var
13+
// CHECK: (A::X) $0 = 0
14+
15+
struct A {
16+
// Declare the constructor, but don't define it to avoid emitting the
17+
// definition in the debug info.
18+
A();
19+
using X = int;
20+
};
21+
22+
A a;
23+
A::X var;

0 commit comments

Comments
 (0)