[clang] [WIP] [clang][DebugInfo] Use mangling number and scope to create unambiguous names for anonymous structures (PR #168533)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 18 05:57:53 PST 2025
github-actions[bot] wrote:
<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results
* 84616 tests passed
* 1087 tests skipped
* 5 tests failed
## Failed Tests
(click on a test name to see its output)
### Clangd Unit Tests
<details>
<summary>Clangd Unit Tests._/ClangdTests/DocumentSymbols/Enums</summary>
```
Script:
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/clangd/unittests/./ClangdTests --gtest_filter=DocumentSymbols.Enums
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp:667
Value of: getSymbols(TU.build())
Expected: has 4 elements where
element #0 (with name (N: "(anonymous enum)")) and (with detail (Detail: "enum")) and (is an object whose given field has 1 element and that element (with name (N: "Red")) and (with detail (Detail: "(unnamed)"))),
element #1 (with name (N: "Color")) and (with detail (Detail: "enum")) and (is an object whose given field has 1 element and that element (with name (N: "Green")) and (with detail (Detail: "Color"))),
element #2 (with name (N: "Color2")) and (with detail (Detail: "enum")) and (is an object whose given field has 1 element and that element (with name (N: "Yellow")) and (with detail (Detail: "Color2"))),
element #3 (with name (N: "ns")) and (is an object whose given field has 1 element and that element (with name (N: "(anonymous enum)")) and (with detail (Detail: "enum")) and (is an object whose given field has 1 element and that element (with name (N: "Black")) and (with detail (Detail: "(unnamed)"))))
Actual: { (anonymous enum) - {"children":[{"detail":"(unnamed enum)","kind":22,"name":"Red","range":{"end":{"character":11,"line":2},"start":{"character":8,"line":2}},"selectionRange":{"end":{"character":11,"line":2},"start":{"character":8,"line":2}}}],"detail":"enum","kind":10,"name":"(anonymous enum)","range":{"end":{"character":7,"line":3},"start":{"character":6,"line":1}},"selectionRange":{"end":{"character":10,"line":1},"start":{"character":6,"line":1}}}, Color - {"children":[{"detail":"Color","kind":22,"name":"Green","range":{"end":{"character":13,"line":5},"start":{"character":8,"line":5}},"selectionRange":{"end":{"character":13,"line":5},"start":{"character":8,"line":5}}}],"detail":"enum","kind":10,"name":"Color","range":{"end":{"character":7,"line":6},"start":{"character":6,"line":4}},"selectionRange":{"end":{"character":16,"line":4},"start":{"character":11,"line":4}}}, Color2 - {"children":[{"detail":"Color2","kind":22,"name":"Yellow","range":{"end":{"character":14,"line":8},"start":{"character":8,"line":8}},"selectionRange":{"end":{"character":14,"line":8},"start":{"character":8,"line":8}}}],"detail":"enum","kind":10,"name":"Color2","range":{"end":{"character":7,"line":9},"start":{"character":6,"line":7}},"selectionRange":{"end":{"character":23,"line":7},"start":{"character":17,"line":7}}}, ns - {"children":[{"children":[{"detail":"(unnamed enum)","kind":22,"name":"Black","range":{"end":{"character":13,"line":12},"start":{"character":8,"line":12}},"selectionRange":{"end":{"character":13,"line":12},"start":{"character":8,"line":12}}}],"detail":"enum","kind":10,"name":"(anonymous enum)","range":{"end":{"character":7,"line":13},"start":{"character":6,"line":11}},"selectionRange":{"end":{"character":10,"line":11},"start":{"character":6,"line":11}}}],"kind":3,"name":"ns","range":{"end":{"character":7,"line":14},"start":{"character":6,"line":10}},"selectionRange":{"end":{"character":18,"line":10},"start":{"character":16,"line":10}}} }, whose element #0 doesn't match, whose given field is { Red - {"detail":"(unnamed enum)","kind":22,"name":"Red","range":{"end":{"character":11,"line":2},"start":{"character":8,"line":2}},"selectionRange":{"end":{"character":11,"line":2},"start":{"character":8,"line":2}}} }, where the following matchers don't match any elements:
matcher #0: (with name (N: "Red")) and (with detail (Detail: "(unnamed)"))
and where the following elements don't match any matchers:
element #0: Red - {"detail":"(unnamed enum)","kind":22,"name":"Red","range":{"end":{"character":11,"line":2},"start":{"character":8,"line":2}},"selectionRange":{"end":{"character":11,"line":2},"start":{"character":8,"line":2}}}
```
</details>
<details>
<summary>Clangd Unit Tests._/ClangdTests/DocumentSymbols/Unnamed</summary>
```
Script:
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/clangd/unittests/./ClangdTests --gtest_filter=DocumentSymbols.Unnamed
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp:536
Value of: getSymbols(TU.build())
Expected: has 2 elements where
element #0 (with name (N: "(anonymous struct)")) and (with kind (Kind: 4-byte object <17-00 00-00>)) and (with detail (Detail: "struct")) and (is an object whose given field has 1 element and that element (with name (N: "InUnnamed")) and (with kind (Kind: 4-byte object <08-00 00-00>)) and (with detail (Detail: "int")) and (is an object whose given field is empty)),
element #1 (with name (N: "UnnamedStruct")) and (with kind (Kind: 4-byte object <0D-00 00-00>)) and (with detail (Detail: "struct (unnamed)")) and (is an object whose given field is empty)
Actual: { (anonymous struct) - {"children":[{"detail":"int","kind":8,"name":"InUnnamed","range":{"end":{"character":21,"line":2},"start":{"character":8,"line":2}},"selectionRange":{"end":{"character":21,"line":2},"start":{"character":12,"line":2}}}],"detail":"struct","kind":23,"name":"(anonymous struct)","range":{"end":{"character":7,"line":3},"start":{"character":6,"line":1}},"selectionRange":{"end":{"character":12,"line":1},"start":{"character":6,"line":1}}}, UnnamedStruct - {"detail":"struct (unnamed struct)","kind":13,"name":"UnnamedStruct","range":{"end":{"character":21,"line":3},"start":{"character":6,"line":1}},"selectionRange":{"end":{"character":21,"line":3},"start":{"character":8,"line":3}}} }, whose element #1 doesn't match
```
</details>
<details>
<summary>Clangd Unit Tests._/ClangdTests/FindExplicitReferencesTest/AllRefsInFoo</summary>
```
Script:
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/clangd/unittests/./ClangdTests --gtest_filter=FindExplicitReferencesTest.AllRefsInFoo
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/clangd/unittests/FindTargetTests.cpp:2135
Expected equality of these values:
ExpectedRefs
Which is: "0: targets = {(unnamed)}\n1: targets = {x}, decl\n2: targets = {fptr}, decl\n3: targets = {a}, decl\n"
Actual.DumpedReferences
Which is: "0: targets = {(unnamed class)}\n1: targets = {x}, decl\n2: targets = {fptr}, decl\n3: targets = {a}, decl\n"
With diff:
@@ -1,3 +1,3 @@
-0: targets = {(unnamed)}
+0: targets = {(unnamed class)}
1: targets = {x}, decl
2: targets = {fptr}, decl
void foo() {
$0^class {} $1^x;
int (*$2^fptr)(int $3^a, int) = nullptr;
}
```
</details>
<details>
<summary>Clangd Unit Tests._/ClangdTests/Hover/All</summary>
```
Script:
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/clangd/unittests/./ClangdTests --gtest_filter=Hover.All
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/clangd/unittests/HoverTests.cpp:3136
Expected equality of these values:
H->Type
Which is: (enum (unnamed enum))
Expected.Type
Which is: (enum (unnamed))
Google Test trace:
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/clangd/unittests/HoverTests.cpp:3129: enumerator ONE
Type: enum (unnamed enum)
Value = 0
ONE
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/clangd/unittests/HoverTests.cpp:3108: // Enumerator in anonymous enum
enum {
ONE, TWO, THREE,
};
void foo() {
int hello = [[O^NE]];
}
```
</details>
### Clang
<details>
<summary>Clang.SemaCXX/builtin-dump-struct.cpp</summary>
```
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/22/include -nostdsysteminc -std=c++20 -verify /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/SemaCXX/builtin-dump-struct.cpp
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/22/include -nostdsysteminc -std=c++20 -verify /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/SemaCXX/builtin-dump-struct.cpp
# .---command stderr------------
# | error: 'expected-error' diagnostics seen but not expected:
# | File /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/SemaCXX/builtin-dump-struct.cpp Line 132: static assertion failed due to requirement 'ToString(B{1, 2, 3, "hello", 4, 5, 6, 7, 8, 9, 10}) == &"\nB {\n A {\n int x = 1\n int y = 2\n int z : 3 = 3\n ConstexprString s = \"hello\"\n }\n int p = 4\n int q = 5\n int anon1 = 6\n int anon2 = 7\n int anon3 = 8\n struct (unnamed) c = {\n int m = 9\n }\n int && r = reference to 10\n}\n"[1]'
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1
--
```
</details>
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.
https://github.com/llvm/llvm-project/pull/168533
More information about the cfe-commits
mailing list