[all-commits] [llvm/llvm-project] 05f663: Revert "[Clang] [AST] Fix placeholder return type ...
Hans via All-commits
all-commits at lists.llvm.org
Thu Aug 15 02:49:50 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 05f663081513c6293f80469132d083e2603ed036
https://github.com/llvm/llvm-project/commit/05f663081513c6293f80469132d083e2603ed036
Author: Hans Wennborg <hans at chromium.org>
Date: 2024-08-15 (Thu, 15 Aug 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/AST/MicrosoftMangle.cpp
R clang/test/CodeGenCXX/mangle-ms-auto-return.cpp
M clang/test/CodeGenCXX/mangle-ms-auto-templates-memptrs.cpp
M clang/test/CodeGenCXX/mangle-ms-auto-templates-nullptr.cpp
M clang/test/CodeGenCXX/mangle-ms-auto-templates.cpp
Log Message:
-----------
Revert "[Clang] [AST] Fix placeholder return type name mangling for MSVC 1920+ / VS2019+ (#102848)"
It cause builds to start failing with
Invalid type expected
UNREACHABLE executed at clang/lib/AST/MicrosoftMangle.cpp:2551!
see comments on the PR.
> Partial fix for https://github.com/llvm/llvm-project/issues/92204.
> This PR just fixes VS2019+ since that is the suite of compilers that I
> require link compatibility with at the moment.
> I still intend to fix VS2017 and to update llvm-undname in future PRs.
> Once those are also finished and merged I'll close out
> https://github.com/llvm/llvm-project/issues/92204.
> I am hoping to get the llvm-undname PR up in a couple of weeks to be
> able to demangle the VS2019+ name mangling.
>
> MSVC 1920+ mangles placeholder return types for non-templated functions
> with "@".
> For example `auto foo() { return 0; }` is mangled as `?foo@@YA at XZ`.
>
> MSVC 1920+ mangles placeholder return types for templated functions as
> the qualifiers of the AutoType followed by "_P" for `auto` and "_T" for
> `decltype(auto)`.
> For example `template<class T> auto foo() { return 0; }` is mangled as
> `??$foo at H@@YA?A_PXZ` when `foo` is instantiated as follows `foo<int>()`.
>
> Lambdas with placeholder return types are still mangled with clang's
> custom mangling since MSVC lambda mangling hasn't been deciphered yet.
> Similarly any pointers in the return type with an address space are
> mangled with clang's custom mangling since that is a clang extension.
>
> We cannot augment `mangleType` to support this mangling scheme as the
> mangling schemes for variables and functions differ.
> auto variables are encoded with the fully deduced type where auto return
> types are not.
> The following two functions with a static variable are mangled the same
> ```
> template<class T>
> int test()
> {
> static int i = 0; // "?i@?1???$test at H@@YAHXZ at 4HA"
> return i;
> }
>
> template<class T>
> int test()
> {
> static auto i = 0; // "?i@?1???$test at H@@YAHXZ at 4HA"
> return i;
> }
> ```
> Inside `mangleType` once we get to mangling the `AutoType` we have no
> context if we are from a variable encoding or some other encoding.
> Therefore it was easier to handle any special casing for `AutoType`
> return types with a separate function instead of using the `mangleType`
> infrastructure.
This reverts commit e0d173d44161bf9b68243845666d58999e74f759
and the wollow-up fa343be414f9364911b947f109f3df5539e23068.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list