[clang] Fix Lambda Mangling in Namespace-Scope Variable Initializers. (PR #159115)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 19 06:28:48 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 origin/main HEAD --extensions h,cpp -- clang/test/CodeGenSYCL/unnamed-types.cpp clang/include/clang/Sema/Sema.h clang/lib/AST/ASTContext.cpp clang/lib/Sema/SemaLambda.cpp clang/test/CodeGenSYCL/unique_stable_name_windows_diff.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index 3c241a59b..532424489 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -361,7 +361,7 @@ Sema::getCurrentMangleNumberContext(const DeclContext *DC) {
       // in the enclosing function context.
       if (isa<VarDecl>(ManglingContextDecl) &&
           !cast<VarDecl>(ManglingContextDecl)->hasGlobalStorage())
-          ManglingContextDecl = nullptr;
+        ManglingContextDecl = nullptr;
     }
     return std::make_tuple(nullptr, ManglingContextDecl);
   }

``````````

</details>


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


More information about the cfe-commits mailing list