[all-commits] [llvm/llvm-project] 92f058: [DebugInfo][CodeView] Resolve forward references t...
Nerixyz via All-commits
all-commits at lists.llvm.org
Tue Jun 23 12:24:16 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 92f058a8b351def1c10cb3f37d05adf813fb9638
https://github.com/llvm/llvm-project/commit/92f058a8b351def1c10cb3f37d05adf813fb9638
Author: Nerixyz <nerixdev at outlook.de>
Date: 2026-06-23 (Tue, 23 Jun 2026)
Changed paths:
M llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
A llvm/test/tools/llvm-pdbutil/forward-cxx-to-c-odr.test
A llvm/test/tools/llvm-pdbutil/forward-cxx-to-c.test
Log Message:
-----------
[DebugInfo][CodeView] Resolve forward references to types without unique name (#203781)
In the following code:
```cpp
// header.h
typedef struct lua_State lua_State;
lua_State *getState();
// source.c
#include "header.h"
struct lua_State { int field; };
lua_State *getState() {
static lua_State state = {.field=42}; // make sure the type is emitted
return &state;
}
// main.cpp
extern "C" {
#include "header.h"
}
int main() { return getState() != 0; }
```
We'll get two forward references for `lua_State` when compiling with
clang-cl. One with a unique name (from C++) and one without (from C).
There's one complete definition for the type (from `source.c`). Since
this is from C, it doesn't have a unique name. Before, we could only
resolve the forward reference from C, not from C++.
With this PR, we can resolve both references. I also tested that the VS
debugger resolves the reference correctly.
I'm not sure if this is a clang bug, because when compiling with MSVC,
the C type also has a unique name. Clang omits the unique name, because
C doesn't have ODR like C++.
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