[llvm] [llvm-debuginfo-analyzer] Add support for LLVM IR format. (PR #135440)

Carlos Alberto Enciso via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 05:59:39 PST 2026


================
@@ -555,10 +555,14 @@ void LVElement::printLinkageName(raw_ostream &OS, bool Full,
 void LVElement::printLinkageName(raw_ostream &OS, bool Full, LVElement *Parent,
                                  LVScope *Scope) const {
   if (options().getPrintFormatting() && options().getAttributeLinkage()) {
-    LVSectionIndex SectionIndex = getReader().getSectionIndex(Scope);
-    std::string Text = (Twine(" 0x") + Twine::utohexstr(SectionIndex) +
-                        Twine(" '") + Twine(getLinkageName()) + Twine("'"))
-                           .str();
+    // Include the section index only if '--attribute=offset', as the
+    // index can be different depending on the specific reader.
+    std::string Section;
+    if (options().getAttributeOffset()) {
+      LVSectionIndex SectionIndex = getReader().getSectionIndex(Scope);
+      Section = (Twine(" 0x" + Twine::utohexstr(SectionIndex) + " ")).str();
+    }
+    std::string Text = (Twine(Section + "'" + getLinkageName() + "'")).str();
----------------
CarlosAlbertoEnciso wrote:

Replaced with
```
    std::string Text;
    if (options().getAttributeOffset()) {
      LVSectionIndex SectionIndex = getReader().getSectionIndex(Scope);
      Text = Twine(" 0x" + Twine::utohexstr(SectionIndex) + " ").str();
    }
    Text += Twine("'" + getLinkageName() + "'").str();

```

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


More information about the llvm-commits mailing list