[llvm] [llvm-objdump] Add inlined function display support (PR #142246)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 01:31:05 PDT 2025


================
@@ -22,60 +23,108 @@
 namespace llvm {
 namespace objdump {
 
+/// Base class for representing the location of a source-level variable or
+/// an inlined function.
+class LiveElement {
+protected:
+  const char *Name;
+  DWARFUnit *Unit;
+  const DWARFDie FuncDie;
+
+public:
+  LiveElement(const char *Name, DWARFUnit *Unit, const DWARFDie FuncDie)
+      : Name(Name), Unit(Unit), FuncDie(FuncDie) {}
+
+  virtual ~LiveElement() {};
+  const char *getName() const { return Name; }
+  DWARFUnit *getDwarfUnit() const { return Unit; }
+  const DWARFDie getFuncDie() const { return FuncDie; }
+
+  virtual bool liveAtAddress(object::SectionedAddress Addr) = 0;
+  virtual void print(raw_ostream &OS, const MCRegisterInfo &MRI) const = 0;
+  virtual void dump(raw_ostream &OS) const = 0;
+  virtual void printElementLine(raw_ostream &OS,
+                                object::SectionedAddress Address,
+                                bool IsEnd) const {}
+};
+
+class InlinedFunction : public LiveElement {
+  DWARFDie InlinedFuncDie;
----------------
jh7370 wrote:

I think we're usually explicit with `private:` in classes in LLVM code. 

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


More information about the llvm-commits mailing list