[libcxx-commits] [PATCH] D74163: [demangler] Fix the parsing of long double literals for PowerPC and S390
Xing Xue via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 25 08:44:34 PST 2020
xingxue updated this revision to Diff 246484.
xingxue added a comment.
Addressed comments:
- Added guard on `S390` to only build in 128-bit `long double` mode.
- Only recognize 'g' for parsing for `powerpc` and `s390`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74163/new/
https://reviews.llvm.org/D74163
Files:
libcxxabi/src/cxa_demangle.cpp
libcxxabi/src/demangle/ItaniumDemangle.h
Index: libcxxabi/src/demangle/ItaniumDemangle.h
===================================================================
--- libcxxabi/src/demangle/ItaniumDemangle.h
+++ libcxxabi/src/demangle/ItaniumDemangle.h
@@ -3789,10 +3789,16 @@
case 'e':
++First;
return make<NameType>("long double");
- // ::= g # __float128
+ // ::= g # long double, __float128
+#if defined(__powerpc__) || defined(__s390__)
+ case 'g':
+ ++First;
+ return make<NameType>("long double");
+#else
case 'g':
++First;
return make<NameType>("__float128");
+#endif
// ::= z # ellipsis
case 'z':
++First;
@@ -4223,9 +4229,18 @@
case 'd':
++First;
return getDerived().template parseFloatingLiteral<double>();
+#if defined(__powerpc__) || defined(__s390__)
+ case 'e':
+ ++First;
+ return getDerived().template parseFloatingLiteral<double>();
+ case 'g':
+ ++First;
+ return getDerived().template parseFloatingLiteral<long double>();
+#else
case 'e':
++First;
return getDerived().template parseFloatingLiteral<long double>();
+#endif
case '_':
if (consumeIf("_Z")) {
Node *R = getDerived().parseEncoding();
@@ -5167,7 +5182,7 @@
struct FloatData<long double>
{
#if defined(__mips__) && defined(__mips_n64) || defined(__aarch64__) || \
- defined(__wasm__)
+ defined(__wasm__) || defined(__powerpc__) || defined(__s390__)
static const size_t mangled_size = 32;
#elif defined(__arm__) || defined(__mips__) || defined(__hexagon__)
static const size_t mangled_size = 16;
Index: libcxxabi/src/cxa_demangle.cpp
===================================================================
--- libcxxabi/src/cxa_demangle.cpp
+++ libcxxabi/src/cxa_demangle.cpp
@@ -6,6 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#if defined(__powerpc__) && \
+ (!defined(__LONG_DOUBLE_128__) || defined(__LONG_DOUBLE_IEEE128__))
+#error "Demangler must be built in double-double long double 128 mode on PPC."
+#elif defined(__s390__) && !defined(__LONG_DOUBLE_128__)
+#error "Demangler must be built in long double 128 mode on S390."
+#endif
+
// FIXME: (possibly) incomplete list of features that clang mangles that this
// file does not yet support:
// - C++ modules TS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74163.246484.patch
Type: text/x-patch
Size: 2335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200225/b8f51e7e/attachment.bin>
More information about the libcxx-commits
mailing list