Skip to content

[libcxxabi][ItaniumDemangle] Demangle DF16b as std::bfloat16_t #120109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libcxxabi/src/demangle/ItaniumDemangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -4330,9 +4330,12 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() {
case 'h':
First += 2;
return make<NameType>("half");
// ::= DF <number> _ # ISO/IEC TS 18661 binary floating point (N bits)
// ::= DF16b # C++23 std::bfloat16_t
// ::= DF <number> _ # ISO/IEC TS 18661 binary floating point (N bits)
case 'F': {
First += 2;
if (consumeIf("16b"))
return make<NameType>("std::bfloat16_t");
Node *DimensionNumber = make<NameType>(parseNumber());
if (!DimensionNumber)
return nullptr;
Expand Down
4 changes: 3 additions & 1 deletion libcxxabi/test/test_demangle.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// Is long double fp128?
#define LDBL_FP128 (__LDBL_MANT_DIG__ == 113)

const char *cases[][2] = {
const char* cases[][2] = {
// clang-format off
{"_Z1A", "A"},
{"_Z1Av", "A()"},
Expand Down Expand Up @@ -30245,6 +30245,8 @@ const char *cases[][2] = {
{"_Z1fDSDRj", "f(_Sat unsigned _Fract)"},
{"_Z1fDSDRl", "f(_Sat long _Fract)"},
{"_Z1fDSDRm", "f(_Sat unsigned long _Fract)"},

{"_Z11bfloat16addDF16bDF16b", "bfloat16add(std::bfloat16_t, std::bfloat16_t)"},
// clang-format on
};

Expand Down
5 changes: 4 additions & 1 deletion llvm/include/llvm/Demangle/ItaniumDemangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -4330,9 +4330,12 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() {
case 'h':
First += 2;
return make<NameType>("half");
// ::= DF <number> _ # ISO/IEC TS 18661 binary floating point (N bits)
// ::= DF16b # C++23 std::bfloat16_t
// ::= DF <number> _ # ISO/IEC TS 18661 binary floating point (N bits)
case 'F': {
First += 2;
if (consumeIf("16b"))
return make<NameType>("std::bfloat16_t");
Node *DimensionNumber = make<NameType>(parseNumber());
if (!DimensionNumber)
return nullptr;
Expand Down
Loading