[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Handle pointer-to-member-data non-type template (PR #187598)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 20 13:56:49 PDT 2026
================
@@ -2015,21 +2015,97 @@ static std::optional<clang::APValue> MakeAPValue(const clang::ASTContext &ast,
return std::nullopt;
bool is_signed = false;
- const bool is_integral = clang_type.IsIntegerOrEnumerationType(is_signed);
+ const bool is_integral = clang_type.IsIntegerOrEnumerationType(is_signed) ||
+ clang_type.IsMemberDataPointerType();
llvm::APSInt apint(*bit_width, !is_signed);
apint = value;
if (is_integral)
return clang::APValue(apint);
+ if (clang_type.IsRealFloatingPointType()) {
+ return clang::APValue(llvm::APFloat(
+ ast.getFloatTypeSemantics(ClangUtil::GetQualType(clang_type)), apint));
+ }
+
// FIXME: we currently support a limited set of floating point types.
// E.g., 16-bit floats are not supported.
- if (!clang_type.IsRealFloatingPointType())
- return std::nullopt;
- return clang::APValue(llvm::APFloat(
- ast.getFloatTypeSemantics(ClangUtil::GetQualType(clang_type)), apint));
+ LLDB_LOG(GetLog(LLDBLog::Types),
+ "MakeAPValue: Unsupported NTTP type class: {0}",
+ clang_type.GetTypeClass());
+
+ lldbassert(false && "Unsupported type for non-type template parameter");
+
+ return std::nullopt;
+}
+
+clang::FieldDecl *DWARFASTParserClang::ResolveMemberDataPointerToFieldDecl(
+ const DWARFDIE &die, uint64_t member_byte_offset) {
+ Log *log = GetLog(DWARFLog::TypeCompletion);
+
+ // die (DW_AT_type) → DW_TAG_ptr_to_member_type
+ DWARFDIE type_die = die.GetReferencedDIE(DW_AT_type);
+ if (!type_die || type_die.Tag() != DW_TAG_ptr_to_member_type) {
----------------
zyn-li wrote:
Good point — I'm not 100% familiar with all the possible type DIEs that could show up in DWARF here, so I'd lean toward keeping the if as defensive coding for now. If this truly is the only valid tag that should reach this point, then an assert would make sense
@clayborg — is DW_TAG_ptr_to_member_type is the only tag we'd ever expect here? should we make it an assert? If so, happy to switch to an assert.
https://github.com/llvm/llvm-project/pull/187598
More information about the lldb-commits
mailing list