[clang] [llvm] [clang][DebugInfo] Add virtual call-site target information in DWARF. (PR #167666)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 08:58:50 PST 2026


================
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple=x86_64-linux -disable-llvm-passes -emit-llvm \
+// RUN:            -debug-info-kind=constructor -dwarf-version=5 -O1 %s \
+// RUN: -o - | FileCheck %s -check-prefix CHECK-BASE
+
+// Simple class with only virtual methods: inlined and not-inlined
+// We check for a generated 'call_target' for:
+// - 'f1', 'f2' and 'f3'.
+
+struct CBase {
+  virtual void f1();
+  virtual void f2();
+  virtual void f3() {}
+};
+void CBase::f1() {}
+
+void bar(CBase *Base) {
+  Base->f1();
+  Base->f2();
+  Base->f3();
+
+  CBase B;
+  B.f1();
+}
+
----------------
dwblaikie wrote:

I'd include a few more comments - about the fact that this is testing three scenarios (out-of-line defined virtual member function, declared-but-not-defined virtual member function, and inline defined virtual member function) but also about whether it's intended that CBase is defined or declared - in this case because it instantiate's the ctor, (at `CBase B`) it should cause the CBase type to be defined. I guess you could turn on standalone debug as a maybe more direct way to say "the type should be defined in this test" (or an explicit out of line ctor would be OK too - with a comment explaining why it's load bearing - or even just a comment on the `CBase B` line to explain what it'll do)

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


More information about the llvm-commits mailing list