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>
Tue, 15 Dec 2020 20:00:57 +0000 (12:00 -0800)
commit6c365cd31e323d2d075573edd927e4f7fb5ec01c
tree81c1f3b89f0560ba2996a8f7f48f29e4dac44469
parentef40d5233b8b6f82927128c5b255cdc3aed9021d
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.

Re-commit with a fix for a couple of regressions.

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/lib/Sema/SemaTemplate.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.cpp
clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp