llvm / llvm/llvm-project

Clang gives local constants a different PDB symbol type than MSVC

Open
#184,367 1 comment 0 reactions 0 assignees View on GitHub
debuginfo
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Not sure this is a bug per se but recording to follow up from https://github.com/swiftlang/llvm-project/pull/12414#discussion_r2873761876

With main.cpp:
```c++
int main() {
static const int kConstant = 42;
return kConstant;
}
```
`cl.exe /Zi /Fetest_cl.exe main.cpp /link /DEBUG`
`clang-cl.exe /Zi /Fetest_clang_cl.exe main.cpp /link /DEBUG`

```
> cvdump.exe -s test_cl.pdb | Select-String kConstant

(0000F8) S_CONSTANT: Type: 0x1002, Value: 42, `main'::`2'::kConstant
```

```
> cvdump.exe -s test_clang_cl.pdb | Select-String kConstant

(0000CC) S_LDATA32: [0002:00000F20], Type: 0x1002, kConstant
```

(note that the display name is also different)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.