Consider reference, pointer, and pointer-to-member TemplateArguments to be different...
authorRichard Smith <richard@metafoo.co.uk>
Sun, 15 Nov 2020 01:37:25 +0000 (17:37 -0800)
committerRichard Smith <richard@metafoo.co.uk>
Fri, 11 Dec 2020 21:26:33 +0000 (13:26 -0800)
commit7b3470baf8bab1919e3ad4c18e2b776c1f7be2d5
tree42b003dff33aefcb16bad3f5f923980c8636a802
parent2d8cc5479b9e9eb96a0e7f70f473c03b82f4084c
Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types.

For the Itanium ABI, this implements the mangling rule suggested in
https://github.com/itanium-cxx-abi/cxx-abi/issues/47, namely mangling
such template arguments as being cast to the parameter type in the case
where the template name is overloadable. This can cause a mangling
change for rare cases, where

 * the template argument declaration is converted from its declared type
   to the type of the template parameter, and
 * the template parameter either has a deduced type or is a parameter of
   a function template.

However, such changes are necessary to avoid mangling collisions. The
ABI changes can be reversed with -fclang-abi-compat=11 or earlier.

Differential Revision: https://reviews.llvm.org/D91488
clang/include/clang/Basic/LangOptions.h
clang/lib/AST/ItaniumMangle.cpp
clang/lib/AST/StmtProfile.cpp
clang/lib/AST/TemplateBase.cpp
clang/test/CodeGenCXX/clang-abi-compat.cpp
clang/test/CodeGenCXX/mangle-class-nttp.cpp
clang/test/CodeGenCXX/mangle-template.cpp
clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp