Issue 124638
Summary clang-cl: Incomplete/missing debug info for classes marked with `novtable`
Labels new issue
Assignees
Reporter Nerixyz
    Classes that are marked with `__declspec(novtable)` won't have full debug info generated (only a forward declaration).

### Reproduction

**Input**:

```cpp
// novtable.cpp
class __declspec(novtable) _Ref_count_base {
    virtual void _Destroy() noexcept {};

    int _Uses = 1;
};

int main() {
 _Ref_count_base base;
    return 0;
}
```

1. Compile with `clang-cl /Zi novtable.cpp`
2. Check the generated debug info:
    ```console
    > llvm-pdbutil pretty -classes -include-types=_Ref_count novtable.pdb
 [...]
      Classes: (Showing 915 items)
        class _Ref_count_base [sizeof = 0] {}
    ```
3. Remove the `__declspec(novtable)`
4. Remove `novtable.pdb`
5. Compile with `clang-cl /Zi novtable.cpp`
6. Check the generated debug info:
    ```console
    > llvm-pdbutil pretty -classes -include-types=_Ref_count novtable.pdb
    [...]
      Classes: (Showing 915 items)
        class _Ref_count_base [sizeof = 16] {
          func [0x000071c0+ 0 - 0x000071c7- 7 | sizeof=  7] (FPO) virtual void __cdecl _Ref_count_base::_Destroy()
          vfptr +0x00 [sizeof=8]
          data +0x08 [sizeof=4] int _Uses
          <padding> (4 bytes)
        }
 [...]
    ```
---

I'd like to fix this myself.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to