[clang] [clang] Fix segmentation fault caused by stack overflow on deeply nested expressions (PR #111701)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 14 02:51:39 PDT 2024


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 4b31568e026c844cc577954b050e0f5a7d96bc0c da8b92cef4227ae0ca46920333ae4022d5d16e00 --extensions cpp,h -- clang/test/CodeGen/deeply-nested-expressions.cpp clang/lib/CodeGen/CGExpr.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenModule.h
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 1eb24c8e7c..6129ad2335 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -1529,9 +1529,8 @@ LValue CodeGenFunction::EmitCheckedLValue(const Expr *E, TypeCheckKind TCK) {
 LValue CodeGenFunction::EmitLValue(const Expr *E,
                                    KnownNonNull_t IsKnownNonNull) {
   LValue LV;
-  CGM.runWithSufficientStackSpace(E->getExprLoc(), [&] {
-    LV = EmitLValueHelper(E, IsKnownNonNull);
-  });
+  CGM.runWithSufficientStackSpace(
+      E->getExprLoc(), [&] { LV = EmitLValueHelper(E, IsKnownNonNull); });
 
   if (IsKnownNonNull && !LV.isKnownNonNull())
     LV.setKnownNonNull();

``````````

</details>


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


More information about the cfe-commits mailing list