[clang] Fix callee type generation (PR #186272)

Prabhu Rajasekaran via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 12 16:00:35 PDT 2026


https://github.com/Prabhuk created https://github.com/llvm/llvm-project/pull/186272

None

>From f83ca146de97e956c559926b75878c2f091d77b0 Mon Sep 17 00:00:00 2001
From: prabhukr <prabhukr at google.com>
Date: Wed, 11 Mar 2026 05:23:34 +0000
Subject: [PATCH] Fix callee type generation

---
 clang/lib/CodeGen/CodeGenModule.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 3b64be7a477d6..79a0eeba80348 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3267,8 +3267,10 @@ void CodeGenModule::createFunctionTypeMetadataForIcall(const FunctionDecl *FD,
 
 void CodeGenModule::createCalleeTypeMetadataForIcall(const QualType &QT,
                                                      llvm::CallBase *CB) {
-  // Only if needed for call graph section and only for indirect calls.
-  if (!CodeGenOpts.CallGraphSection || !CB->isIndirectCall())
+  // Only if needed for call graph section and only for indirect calls that are
+  // visible externally.
+  if (!CodeGenOpts.CallGraphSection || !CB->isIndirectCall() ||
+      !isExternallyVisible(QT->getLinkage()))
     return;
 
   llvm::Metadata *TypeIdMD = CreateMetadataIdentifierGeneralized(QT);



More information about the cfe-commits mailing list