[Lldb-commits] [lldb] [lldb][TypeSystemClang] Add support for floating point template argument constants (PR #127206)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 17 00:28:58 PST 2025
================
@@ -1973,6 +1973,30 @@ class DWARFASTParserClang::DelayedAddObjCClassProperty {
ClangASTMetadata m_metadata;
};
+static std::optional<clang::APValue> MakeAPValue(const clang::ASTContext &ast,
+ CompilerType clang_type,
+ uint64_t bit_width,
+ uint64_t value) {
+ 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)
+ return clang::APValue(apint);
+
+ uint32_t count;
+ bool is_complex;
+ // FIXME: we currently support a limited set of floating point types.
+ // E.g., 16-bit floats are not supported.
+ if (!clang_type.IsFloatingPointType(count, is_complex))
+ return std::nullopt;
+
+ return clang::APValue(llvm::APFloat(
+ ast.getFloatTypeSemantics(ClangUtil::GetQualType(clang_type)), apint));
----------------
labath wrote:
:+1:
https://github.com/llvm/llvm-project/pull/127206
More information about the lldb-commits
mailing list