[PATCH] D95487: Itanium Mangling: Fix handling of <expr-primary> in <template-arg>.

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 26 15:47:32 PST 2021


jyknight created this revision.
Herald added a subscriber: kristof.beyls.
jyknight requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95487

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95487.319423.patch
Type: text/x-patch
Size: 39234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210126/0bdf5006/attachment-0001.bin>


More information about the cfe-commits mailing list