[clang] [Clang][Parser] Fix crash of clang when trying to convert a cast to … (PR #78840)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 20 02:35:06 PST 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 a7d7da6e45992b79fe712c1e228cc57c9f27fa7a 2503669a55f8dae534440a4eacb66a4500f78e3f -- clang/lib/AST/ExprConstant.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 165046bd06..dc9e1bcbd3 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -9274,11 +9274,10 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
     auto *AT = Info.Ctx.getAsArrayType(SubExpr->getType());
     if (auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
       Result.addArray(Info, E, CAT);
-    }
-    else {
+    } else {
       if (Result.checkNullPointer(Info, E, CSK_ArrayToPointer)) {
         // Only add unsized array if there actually is a pointer.
-        return false;        
+        return false;
       } else {
         Result.addUnsizedArray(Info, E, AT->getElementType());
       }

``````````

</details>


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


More information about the cfe-commits mailing list