Skip to content

Commit 30824c4

Browse files
authored
[lldb][DWARFASTParserClang] GetCXXObjectParameter to take DeclContext DIE parameter (#144876)
I'm trying to call `GetCXXObjectParameter` from unit-tests in a follow-up patch and taking a `DWARFDIE` instead of `clang::DeclContext` makes that much simpler. These should be equivalent, since all we're trying to check is that the parent context is a record type.
1 parent 74054ca commit 30824c4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,14 @@ static bool TagIsRecordType(dw_tag_t tag) {
163163
/// a default DWARFDIE. If \c containing_decl_ctx is not a valid
164164
/// C++ declaration context for class methods, assume no object
165165
/// parameter exists for the given \c subprogram.
166-
static DWARFDIE
167-
GetCXXObjectParameter(const DWARFDIE &subprogram,
168-
const clang::DeclContext &containing_decl_ctx) {
166+
static DWARFDIE GetCXXObjectParameter(const DWARFDIE &subprogram,
167+
const DWARFDIE &decl_ctx_die) {
168+
assert(subprogram);
169169
assert(subprogram.Tag() == DW_TAG_subprogram ||
170170
subprogram.Tag() == DW_TAG_inlined_subroutine ||
171171
subprogram.Tag() == DW_TAG_subroutine_type);
172172

173-
if (!DeclKindIsCXXClass(containing_decl_ctx.getDeclKind()))
173+
if (!decl_ctx_die.IsStructUnionOrClass())
174174
return {};
175175

176176
if (DWARFDIE object_parameter =
@@ -1304,8 +1304,7 @@ DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
13041304
clang::CallingConv calling_convention =
13051305
ConvertDWARFCallingConventionToClang(attrs);
13061306

1307-
const DWARFDIE object_parameter =
1308-
GetCXXObjectParameter(die, *containing_decl_ctx);
1307+
const DWARFDIE object_parameter = GetCXXObjectParameter(die, decl_ctx_die);
13091308

13101309
// clang_type will get the function prototype clang type after this
13111310
// call
@@ -2411,12 +2410,13 @@ DWARFASTParserClang::ConstructDemangledNameFromDWARF(const DWARFDIE &die) {
24112410
DWARFDeclContext decl_ctx = die.GetDWARFDeclContext();
24122411
sstr << decl_ctx.GetQualifiedName();
24132412

2413+
DWARFDIE decl_ctx_die;
24142414
clang::DeclContext *containing_decl_ctx =
2415-
GetClangDeclContextContainingDIE(die, nullptr);
2415+
GetClangDeclContextContainingDIE(die, &decl_ctx_die);
24162416
assert(containing_decl_ctx);
24172417

2418-
const unsigned cv_quals = GetCXXMethodCVQuals(
2419-
die, GetCXXObjectParameter(die, *containing_decl_ctx));
2418+
const unsigned cv_quals =
2419+
GetCXXMethodCVQuals(die, GetCXXObjectParameter(die, decl_ctx_die));
24202420

24212421
ParseChildParameters(containing_decl_ctx, die, is_variadic,
24222422
has_template_params, param_types, param_names);

0 commit comments

Comments
 (0)