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

James Y Knight via All-commits all-commits at lists.llvm.org
Wed Jan 27 13:52:45 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c7aeaebb3ac1b94200b59b111742cb6b8f090c2
      https://github.com/llvm/llvm-project/commit/9c7aeaebb3ac1b94200b59b111742cb6b8f090c2
  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


  Commit: 8ca33605ff0cfc536f5c6710fb5f6378bf11959a
      https://github.com/llvm/llvm-project/commit/8ca33605ff0cfc536f5c6710fb5f6378bf11959a
  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


  Commit: a7246ba02a8923f316419a62d836dbe1c0b437bd
      https://github.com/llvm/llvm-project/commit/a7246ba02a8923f316419a62d836dbe1c0b437bd
  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


Compare: https://github.com/llvm/llvm-project/compare/58aa049b9b80...a7246ba02a89


More information about the All-commits mailing list