[clang] [Clang](NFC) Add coverage for VTable debug info (PR #151818)

Javier Lopez-Gomez via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 5 10:59:00 PDT 2025


================
@@ -0,0 +1,96 @@
+// For CTemplate we check in case of:
+// - Implicitly instantiate whole class by up-casting:
+//   * The vtable is generated with comdat
+//   * Its '_vtable$' is generated
+// - Implicitly instantiate member function only:
+//  # when optimized:
+//   * The vtable is vanished (no declaration)
+//   * Its '_vtable$' is generated without associating to vtable
+//  # when non-optimized:
+//   * The vtable is generated with comdat only if non-optimized
+//   * Its '_vtable$' is generated regardless optimized or not
+// - Define explicitly instantiation:
+//   * The vtable is generated with comdat
+//   * Its '_vtable$' is generated
+// - Declare explicitly instantiation as extern:
+//   * The vtable is declared
+//   * Its '_vtable$' is generated only if optimized
----------------
jalopezg-git wrote:

Let's improve the wording here a bit (for future readers).
```suggestion
// For the `CTemplate` templated class below, check the following cases:
// - Implicitly instantiate whole class by up-casting (`NOCAST` not defined):
//   * The vtable is generated with a COMDAT specifier
//   * Its '_vtable$' is generated
// - Implicitly instantiate member function only (`NOCAST` defined):
//  # when optimized:
//   * The vtable has no declaration
//   * Its '_vtable$' is generated, but not associated to vtable declaration
//  # when non-optimized:
//   * The vtable is generated with a COMDAT specifier
//   * Its '_vtable$' is generated regardless of optimization level
// - Define explicitly instantiation (`EXPLICIT` defined):
//   * The vtable is generated with a COMDAT specifier
//   * Its '_vtable$' is generated
// - Declare explicitly instantiation as `extern` (`EXTERN` defined):
//   * The vtable is declared
//   * Its '_vtable$' is generated only if optimized
```

https://github.com/llvm/llvm-project/pull/151818


More information about the cfe-commits mailing list