[all-commits] [llvm/llvm-project] b0085d: Itanium Mangling: Mangle `__alignof__` differently...

James Y Knight via All-commits all-commits at lists.llvm.org
Wed Jan 27 17:02:58 PST 2021


  Branch: refs/heads/release/12.x
  Home:   https://github.com/llvm/llvm-project
  Commit: b0085d205b3063c332a080599830ef0500cb6924
      https://github.com/llvm/llvm-project/commit/b0085d205b3063c332a080599830ef0500cb6924
  Author: James Y Knight <jyknight at google.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    M clang/lib/AST/ItaniumMangle.cpp
    A clang/test/CodeGenCXX/mangle-alignof.cpp
    M clang/test/CodeGenCXX/microsoft-uuidof-mangling.cpp
    M libcxxabi/src/demangle/ItaniumDemangle.h
    M libcxxabi/test/test_demangle.pass.cpp
    M llvm/include/llvm/Demangle/ItaniumDemangle.h

  Log Message:
  -----------
  Itanium Mangling: Mangle `__alignof__` differently than `alignof`.

The two operations have acted differently since Clang 8, but were
unfortunately mangled the same. The new mangling uses new "vendor
extended expression" syntax proposed in
https://github.com/itanium-cxx-abi/cxx-abi/issues/112

GCC had the same mangling problem, https://gcc.gnu.org/PR88115, and
will hopefully be switching to the same mangling as implemented here.

Additionally, fix the mangling of `__uuidof` to use the new extension
syntax, instead of its previous nonstandard special-case.

Adjusts the demangler accordingly.

Differential Revision: https://reviews.llvm.org/D93922

(cherry picked from commit 9c7aeaebb3ac1b94200b59b111742cb6b8f090c2)


  Commit: 7da92afbf08e90960f7e5dee00bbf6ef8f323a5c
      https://github.com/llvm/llvm-project/commit/7da92afbf08e90960f7e5dee00bbf6ef8f323a5c
  Author: James Y Knight <jyknight at google.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/test/CodeGenCXX/clang-abi-compat.cpp
    M clang/test/CodeGenCXX/mangle-abi-tag.cpp
    M clang/test/CodeGenCXX/mangle-concept.cpp
    M clang/test/CodeGenCXX/mangle-template.cpp
    M clang/test/CodeGenCXX/mangle.cpp
    M clang/test/CodeGenCXX/matrix-type.cpp
    M clang/test/CodeGenCXX/microsoft-uuidof-mangling.cpp

  Log Message:
  -----------
  Itanium Mangling: Fix handling of <expr-primary> in <template-arg>.

Previously, we were emitting an extraneous X .. E in <template-arg>
around an <expr-primary> if the template argument was constructed from
an expression (rather than an already-evaluated literal value).  In
such a case, we would then e.g. emit 'XLi0EE' instead of 'Li0E'.

We had one special-case for DeclRefExpr expressions, in particular, to
omit them the mangled-name without the surrounding X/E. However,
unfortunately, that special case also triggered for ParmVarDecl (a
subtype of VarDecl), and _incorrectly_ emitted 'L_Z .. E' instead of
the proper 'Xfp_E'.

This change causes mangleExpression itself to be responsible for
emitting X/E around non-primary expressions, which removes the
special-case, and corrects both these problems.

Differential Revision: https://reviews.llvm.org/D95487

(cherry picked from commit 8ca33605ff0cfc536f5c6710fb5f6378bf11959a)


  Commit: 0b7b698fecd37415a635a586e5ca159ab0b8872f
      https://github.com/llvm/llvm-project/commit/0b7b698fecd37415a635a586e5ca159ab0b8872f
  Author: James Y Knight <jyknight at google.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/test/CodeGen/enable_if.c
    M clang/test/CodeGenCXX/clang-abi-compat.cpp
    M clang/test/CodeGenCXX/enable_if.cpp

  Log Message:
  -----------
  Itanium Mangling: In 'enable_if', omit X/E around <expr-primary>.

The Clang enable_if extension is mangled as an <extended-qualifier>,
which is supposed to contain <template-args>. However, we were
unconditionally emitting X/E around its arguments, neglecting the fact
that <expr-primary> should be emitted directly without the surrounding
X/E.

Differential Revision: https://reviews.llvm.org/D95488

(cherry picked from commit a7246ba02a8923f316419a62d836dbe1c0b437bd)


Compare: https://github.com/llvm/llvm-project/compare/8364f5369eee...0b7b698fecd3


More information about the All-commits mailing list