[clang] [clang][bytecode] Use qualified name in `Function::dump()` (PR #191958)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 22:54:53 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/191958.diff


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Disasm.cpp (+8-1) 
- (modified) clang/lib/AST/ByteCode/Program.h (+2) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Disasm.cpp b/clang/lib/AST/ByteCode/Disasm.cpp
index f4355522eb8e0..6a90c6ab98fa6 100644
--- a/clang/lib/AST/ByteCode/Disasm.cpp
+++ b/clang/lib/AST/ByteCode/Disasm.cpp
@@ -150,7 +150,14 @@ LLVM_DUMP_METHOD void Function::dump(llvm::raw_ostream &OS,
   }
   {
     ColorScope SC(OS, true, {llvm::raw_ostream::BRIGHT_GREEN, true});
-    OS << getName() << " " << (const void *)this << "\n";
+    if (const FunctionDecl *FD = getDecl()) {
+      FD->getNameForDiagnostic(
+          OS, P.getContext().getASTContext().getPrintingPolicy(),
+          /*Qualified=*/true);
+    } else {
+      OS << getName();
+    }
+    OS << " " << (const void *)this << "\n";
   }
   OS << "frame size: " << getFrameSize() << "\n";
   OS << "arg size:   " << getArgSize() << "\n";
diff --git a/clang/lib/AST/ByteCode/Program.h b/clang/lib/AST/ByteCode/Program.h
index 91126a51e8ddc..e3ec0c07736a3 100644
--- a/clang/lib/AST/ByteCode/Program.h
+++ b/clang/lib/AST/ByteCode/Program.h
@@ -54,6 +54,8 @@ class Program final {
     }
   }
 
+  const Context &getContext() const { return Ctx; }
+
   /// Marshals a native pointer to an ID for embedding in bytecode.
   unsigned getOrCreateNativePointer(const void *Ptr);
 

``````````

</details>


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


More information about the cfe-commits mailing list