Chandler Carruth and Christopher Di Bella
8a59f2a76b
Fix mangling collision for C++ class template specializations ( #7269 )
...
Carbon-side thunks (for example the `Copy`/`Destroy` witness thunks
generated for imported C++ types) are mangled by Carbon, and their names
incorporate a fingerprint of the involved types. The instruction
fingerprinter identifies a class only by its name and parent scope,
which is sufficient for Carbon classes but not for imported C++ classes:
different specializations of one class template (and other cases such as
types in anonymous namespaces) share a Carbon name and parent scope. As
a result, the thunks for two distinct specializations could mangle to
the same name, producing a single LLVM function with two definitions and
failing `verifyModule` during lowering.
When fingerprinting a class imported from C++, also include the Clang
mangled name of its type.
Test: toolchain/lower/testdata/interop/cpp/thunks.carbon gains a split
with two specializations of one class template, each requiring a thunk;
their thunks now get distinct mangled names instead of colliding.
Assisted-by: Claude Code
---------
Co-authored-by: Christopher Di Bella <cjdb.ns@gmail.com >
2026-05-30 08:13:00 +00:00
..
2026-05-30 08:13:00 +00:00
2026-05-30 08:13:00 +00:00
2026-05-07 19:42:23 +00:00
2026-04-29 18:13:42 +00:00
2026-05-01 21:22:32 +00:00
2026-05-07 21:58:29 +00:00
2026-04-29 18:33:53 +00:00
2026-05-21 00:02:29 +00:00
2026-05-19 23:16:51 +00:00
2026-05-19 23:16:51 +00:00
2026-05-19 23:16:51 +00:00
2026-05-19 18:01:54 +00:00
2026-05-18 20:09:17 +00:00
2026-05-19 23:16:51 +00:00
2026-05-22 02:48:07 +00:00
2026-03-27 21:41:04 +00:00
2026-05-26 20:38:49 +00:00
2026-04-29 18:33:53 +00:00
2025-12-11 21:41:47 +00:00
2026-05-12 19:03:55 +00:00
2025-12-11 21:41:47 +00:00
2026-05-29 22:42:12 +00:00
2026-05-29 22:42:12 +00:00
2026-05-18 20:09:17 +00:00
2026-05-19 18:01:54 +00:00
2026-02-19 23:33:36 +00:00
2026-05-27 21:44:29 +00:00
2026-02-19 16:24:07 +00:00
2026-04-23 20:11:04 +00:00
2026-02-04 17:24:55 +00:00
2026-02-25 15:15:29 +00:00
2026-05-11 18:22:31 +00:00
2026-05-19 18:01:54 +00:00
2026-04-29 18:13:42 +00:00
2026-05-27 22:04:48 +00:00
2026-03-27 19:36:52 +00:00
2026-05-27 15:43:41 +00:00
2026-05-01 21:22:32 +00:00
2026-05-18 20:09:17 +00:00
2026-05-13 17:40:45 +00:00
2026-05-13 17:40:45 +00:00
2026-02-19 16:24:07 +00:00
2026-02-19 16:24:07 +00:00
2026-03-27 19:36:52 +00:00
2026-02-19 16:24:07 +00:00
2026-05-18 20:09:17 +00:00
2026-05-18 20:09:17 +00:00
2026-05-12 17:22:44 +00:00
2026-05-18 20:09:17 +00:00
2025-12-30 19:18:34 +00:00
2026-02-19 23:33:36 +00:00
2026-05-01 22:45:22 +00:00
2026-02-19 23:33:36 +00:00
2026-03-06 17:35:48 +00:00
2026-05-19 18:01:54 +00:00
2026-05-01 18:46:52 +00:00
2026-05-19 18:01:54 +00:00
2026-03-31 22:27:43 +00:00
2026-02-09 22:00:21 +00:00
2026-05-21 21:21:50 +00:00
2026-05-19 18:01:54 +00:00
2026-01-14 16:58:15 +00:00
2026-05-22 02:48:07 +00:00
2026-03-22 02:03:48 +00:00
2026-04-29 00:28:00 +00:00
2026-03-10 20:04:28 +00:00
2026-05-18 20:09:17 +00:00
2026-03-09 22:30:16 +00:00
2026-03-26 15:26:56 +00:00
2026-05-21 00:02:29 +00:00
2026-02-26 19:21:19 +00:00
2026-04-28 20:10:13 +00:00
2026-05-18 20:09:17 +00:00
2026-05-13 16:11:20 +00:00
2026-05-02 01:09:50 +00:00
2026-02-09 22:00:21 +00:00
2026-05-15 18:53:51 +00:00
2026-05-25 23:02:06 +00:00
2026-04-24 19:08:11 +00:00
2026-05-06 14:17:54 +00:00
2026-05-13 17:40:45 +00:00
2026-05-13 16:11:20 +00:00
2026-05-21 00:02:29 +00:00
2026-05-21 00:02:29 +00:00
2026-03-24 20:56:44 +00:00
2025-11-11 16:36:15 +00:00
2026-04-29 18:13:42 +00:00
2026-04-16 23:31:31 +00:00
2026-02-19 23:33:36 +00:00
2026-02-19 16:24:07 +00:00
2026-05-18 20:09:17 +00:00
2026-02-19 23:33:36 +00:00
2026-02-26 20:10:50 +00:00
2026-02-26 20:10:50 +00:00
2026-05-15 18:53:51 +00:00
2026-02-25 15:15:29 +00:00
2026-05-29 00:55:04 +00:00
2026-05-13 17:40:45 +00:00
2026-05-19 18:01:54 +00:00
2026-02-19 16:24:07 +00:00
2026-04-22 23:38:21 +00:00
2026-04-22 23:38:21 +00:00
2026-05-19 18:01:54 +00:00
2026-05-13 17:16:02 +00:00
2025-12-09 20:38:50 +00:00
2025-12-09 20:38:50 +00:00
2026-01-14 19:32:03 +00:00
2026-05-13 21:22:46 +00:00
2026-04-29 18:33:53 +00:00
2026-02-25 15:15:29 +00:00
2026-05-22 02:48:07 +00:00
2026-04-29 18:33:53 +00:00
2026-05-18 20:09:17 +00:00
2026-04-29 00:28:00 +00:00
2026-05-04 21:50:13 +00:00
2026-05-13 18:24:31 +00:00
2026-05-13 18:24:31 +00:00
2026-03-28 00:06:06 +00:00
2026-03-26 15:26:56 +00:00
2026-03-26 15:26:56 +00:00
2026-05-01 19:53:16 +00:00
2026-02-19 23:33:36 +00:00
2025-11-14 13:50:56 +00:00
2026-05-07 13:44:40 +00:00
2026-05-07 13:44:40 +00:00
2026-05-27 15:43:41 +00:00
2026-05-22 21:12:06 +00:00
2026-05-13 17:40:45 +00:00
2026-05-13 18:49:02 +00:00
2026-03-26 15:26:56 +00:00
2026-05-11 14:17:18 +00:00
2026-05-07 22:33:47 +00:00
2026-04-27 19:04:59 +00:00
2026-02-26 23:01:24 +00:00
2026-02-26 18:57:15 +00:00
2026-02-19 23:33:36 +00:00