[clang] [NFC][Clang][CodeGen] Pass call-site SourceLocation to EmitKCFIOperandBundle (PR #245533)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 00:14:22 PST 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-codegen

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>

Forward the call-site SourceLocation from EmitCall into
EmitKCFIOperandBundle. This is currently unused, and prepares for emitting
UBSan diagnostic source locations in kCFI diagnostics mode in follow-up
changes.

Assisted-by: Gemini

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


3 Files Affected:

- (modified) clang/lib/CodeGen/CGCall.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+2-1) 


``````````diff
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 13260a3c01cd0..1ae64c60d494e 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -6426,7 +6426,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
 
   if (SanOpts.has(SanitizerKind::KCFI) &&
       !isa_and_nonnull<FunctionDecl>(TargetDecl))
-    EmitKCFIOperandBundle(ConcreteCallee, BundleList);
+    EmitKCFIOperandBundle(ConcreteCallee, BundleList, Loc);
 
   // Add the pointer-authentication bundle.
   EmitPointerAuthOperandBundle(ConcreteCallee.getPointerAuthInfo(), BundleList);
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 5d4de45a8f2fc..b6986e32a9a0c 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -2914,7 +2914,8 @@ void CodeGenFunction::EmitSanitizerStatReport(llvm::SanitizerStatKind SSK) {
 }
 
 void CodeGenFunction::EmitKCFIOperandBundle(
-    const CGCallee &Callee, SmallVectorImpl<llvm::OperandBundleDef> &Bundles) {
+    const CGCallee &Callee, SmallVectorImpl<llvm::OperandBundleDef> &Bundles,
+    SourceLocation /*Loc*/) {
   const CGCalleeInfo &CI = Callee.getAbstractInfo();
   const FunctionProtoType *FP = CI.getCalleeFunctionProtoType();
   if (!FP)
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index c46c33a19cce2..839f92b7e232f 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -5503,7 +5503,8 @@ class CodeGenFunction : public CodeGenTypeCache {
   llvm::Constant *EmitCheckSourceLocation(SourceLocation Loc);
 
   void EmitKCFIOperandBundle(const CGCallee &Callee,
-                             SmallVectorImpl<llvm::OperandBundleDef> &Bundles);
+                             SmallVectorImpl<llvm::OperandBundleDef> &Bundles,
+                             SourceLocation Loc);
 
   /// Create a basic block that will either trap or call a handler function in
   /// the UBSan runtime with the provided arguments, and create a conditional

``````````

</details>


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


More information about the cfe-commits mailing list