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

Carlos Alberto Enciso via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 04:05:55 PST 2025


CarlosAlbertoEnciso wrote:

Given the test case:
```
class CBaseOne {
  virtual void foo(int &);
};

struct CDerivedOne : CBaseOne {
  void foo(int &);
};

void CDerivedOne::foo(int &) {
}

struct CBaseTwo {
  CDerivedOne *DerivedOne;
};

struct CDerivedTwo : CBaseTwo {
  void bar(int &);
};

void CDerivedTwo::bar(int &j) {
  DerivedOne->foo(j);
}
```
This is the generated DWARF
```
0x00000072:   DW_TAG_subprogram
                DW_AT_specification	(0x00000041 "_ZN11CDerivedOne3fooERi")
                ...

0x00000091:   DW_TAG_structure_type
                DW_AT_name	("CDerivedTwo")
                ...

0x0000009d:     DW_TAG_subprogram
                  DW_AT_linkage_name	("_ZN11CDerivedTwo3barERi")
                  DW_AT_name	("bar")

0x000000c8:   DW_TAG_subprogram
                ...
                DW_AT_specification	(0x0000009d "_ZN11CDerivedTwo3barERi")

0x000000ea:     DW_TAG_call_site
                  DW_AT_call_target	(DW_OP_reg0 RAX)
                  DW_AT_call_tail_call	(true)
                  DW_AT_call_pc	(0x0000000000000019)
                  DW_AT_call_origin	(0x00000072 "_ZN11CDerivedOne3fooERi")

```

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


More information about the llvm-commits mailing list