[Lldb-commits] [lldb] [lldb] Add support for displaying `__float128` variables (PR #98369)
via lldb-commits
lldb-commits at lists.llvm.org
Wed May 21 02:28:28 PDT 2025
================
@@ -4737,19 +4750,23 @@ CompilerType TypeSystemClang::CreateGenericFunctionPrototype() {
// Exploring the type
const llvm::fltSemantics &
-TypeSystemClang::GetFloatTypeSemantics(size_t byte_size) {
+TypeSystemClang::GetFloatTypeSemantics(size_t byte_size, bool prefer_float128) {
clang::ASTContext &ast = getASTContext();
const size_t bit_size = byte_size * 8;
if (bit_size == ast.getTypeSize(ast.FloatTy))
return ast.getFloatTypeSemantics(ast.FloatTy);
else if (bit_size == ast.getTypeSize(ast.DoubleTy))
return ast.getFloatTypeSemantics(ast.DoubleTy);
+ else if (prefer_float128 && bit_size == ast.getTypeSize(ast.Float128Ty))
+ return ast.getFloatTypeSemantics(ast.Float128Ty);
else if (bit_size == ast.getTypeSize(ast.LongDoubleTy) ||
bit_size == llvm::APFloat::semanticsSizeInBits(
ast.getFloatTypeSemantics(ast.LongDoubleTy)))
return ast.getFloatTypeSemantics(ast.LongDoubleTy);
else if (bit_size == ast.getTypeSize(ast.HalfTy))
return ast.getFloatTypeSemantics(ast.HalfTy);
+ else if (bit_size == ast.getTypeSize(ast.Float128Ty))
----------------
beetrees wrote:
If the user formats a 128-bit value using `eFormatFloat` on a target where the only 128-bit float is float128 (a.k.a. `long double` is some other size), then the value should be formatted as a float128. The `eFormatFloat128` format is only needed to disambiguate when `long double` and float128 are both 128 bits.
https://github.com/llvm/llvm-project/pull/98369
More information about the lldb-commits
mailing list