[llvm] [DebugInfo] Fix incorrect debug attribution for inlined allocas (PR #144345)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 16 05:54:36 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/Transforms/Utils/InlineFunction.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 5d7546f22..c5549c38d 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -2710,8 +2710,9 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
 
     // Clear debug locations for all inlined allocas to prevent stack protection
     // code from inheriting incorrect source attribution
-    for (Function::iterator BB = FirstNewBlock, E = Caller->end(); BB != E; ++BB) {
-     for (BasicBlock::iterator I = BB->begin(), IE = BB->end(); I != IE; ++I) {
+    for (Function::iterator BB = FirstNewBlock, E = Caller->end(); BB != E;
+         ++BB) {
+      for (BasicBlock::iterator I = BB->begin(), IE = BB->end(); I != IE; ++I) {
         if (auto *AI = dyn_cast<AllocaInst>(I)) {
           AI->setDebugLoc(DebugLoc());
         }

``````````

</details>


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


More information about the llvm-commits mailing list