[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Handle pointer-to-member-data non-type template (PR #187598)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 23 10:52:56 PDT 2026


================
@@ -2015,21 +2015,92 @@ 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);
 
-  llvm::APSInt apint(*bit_width, !is_signed);
-  apint = value;
-
-  if (is_integral)
+  if (clang_type.IsIntegerOrEnumerationType(is_signed) ||
+      clang_type.IsMemberDataPointerType()) {
+    llvm::APSInt apint(*bit_width, !is_signed);
+    apint = value;
     return clang::APValue(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;
+  if (clang_type.IsRealFloatingPointType()) {
+    llvm::APInt apint(*bit_width, value);
+    return clang::APValue(llvm::APFloat(
+        ast.getFloatTypeSemantics(ClangUtil::GetQualType(clang_type)), apint));
+  }
+
+  LLDB_LOG(GetLog(LLDBLog::Types),
----------------
clayborg wrote:

I would prefer this logging to always show up. If logging isn't enabled we don't know that we have an issue and we end up ruining the template by inserting "void" in as the template parameter when we return `std::nullopt`. Can we use:

```
dwarf->GetObjectFile()->GetModule()->LogMessage(...)
```
for this so the error always shows up with a message like:
```
error: unsupported template value type in die 0xXXXXXXXX, please file a bug
```


https://github.com/llvm/llvm-project/pull/187598


More information about the lldb-commits mailing list