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

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 12 16:58:15 PDT 2026


================
@@ -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()))
----------------
ilovepi wrote:

I guess the next relevant question is if your analysis can still work without these bits of the metadata (e.g. are edges missing). Another question that comes to mind is if this ultimately fails because the call is devirtualized (e.g. no longer indirect...).

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


More information about the cfe-commits mailing list