Skip to content

Commit

Permalink
[demangler] PPC and S390: Fix parsing of e-prefixed long double literals
Browse files Browse the repository at this point in the history
Summary:
This patch is to fix the parsing of long double literals encoded with the e prefix on PowerPC and S390. For both PowerPC and S390, type code e is used for 64-bit long double literals and g is used for 128-bit long double literals. libcxxabi test case test_demangle.pass.cpp fails without the fix.

Authored by: xingxue-ibm

Reviewers: hubert.reinterpretcast, jasonliu, erik.pilkington, uweigand, mclow.li
sts, libc++abi

Reviewed by: hubert.reinterpretcast, erik.pilkington

Differential Revision: https://reviews.llvm.org/D74163
  • Loading branch information
xingxue-ibm committed Apr 15, 2020
1 parent 1242018 commit 4578fa8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libcxxabi/src/demangle/ItaniumDemangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -4225,7 +4225,13 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExprPrimary() {
return getDerived().template parseFloatingLiteral<double>();
case 'e':
++First;
#if defined(__powerpc__) || defined(__s390__)
// Handle cases where long doubles encoded with e have the same size
// and representation as doubles.
return getDerived().template parseFloatingLiteral<double>();
#else
return getDerived().template parseFloatingLiteral<long double>();
#endif
case '_':
if (consumeIf("_Z")) {
Node *R = getDerived().parseEncoding();
Expand Down
6 changes: 6 additions & 0 deletions llvm/include/llvm/Demangle/ItaniumDemangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -4225,7 +4225,13 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExprPrimary() {
return getDerived().template parseFloatingLiteral<double>();
case 'e':
++First;
#if defined(__powerpc__) || defined(__s390__)
// Handle cases where long doubles encoded with e have the same size
// and representation as doubles.
return getDerived().template parseFloatingLiteral<double>();
#else
return getDerived().template parseFloatingLiteral<long double>();
#endif
case '_':
if (consumeIf("_Z")) {
Node *R = getDerived().parseEncoding();
Expand Down

0 comments on commit 4578fa8

Please sign in to comment.