[clang] [clang] Improve diagnostics with incompatible VLA types (PR #101261)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 30 16:39:00 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 ee57ce57d8094026e2795182758bc57027a72293 667894f8e4e334e7fc32418bee95803138dfad40 --extensions cpp -- clang/test/Sema/incompatible-vla-assignment.cpp clang/lib/Sema/SemaExpr.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e93fb869e8..84129a0f1c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -16655,10 +16655,12 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
return diag::err_typecheck_convert_incompatible_pointer;
DeclRefExpr *SrcSizeExpr = nullptr, *DstSizeExpr = nullptr;
- if (ImplicitCastExpr* I = dyn_cast<ImplicitCastExpr>(SrcTypeVLA->getSizeExpr()))
- SrcSizeExpr = dyn_cast<DeclRefExpr>(I->getSubExpr());
- if (ImplicitCastExpr* I = dyn_cast<ImplicitCastExpr>(DstTypeVLA->getSizeExpr()))
- DstSizeExpr = dyn_cast<DeclRefExpr>(I->getSubExpr());
+ if (ImplicitCastExpr *I =
+ dyn_cast<ImplicitCastExpr>(SrcTypeVLA->getSizeExpr()))
+ SrcSizeExpr = dyn_cast<DeclRefExpr>(I->getSubExpr());
+ if (ImplicitCastExpr *I =
+ dyn_cast<ImplicitCastExpr>(DstTypeVLA->getSizeExpr()))
+ DstSizeExpr = dyn_cast<DeclRefExpr>(I->getSubExpr());
if (SrcSizeExpr == nullptr || DstSizeExpr == nullptr)
return diag::err_typecheck_convert_incompatible_pointer;
``````````
</details>
https://github.com/llvm/llvm-project/pull/101261
More information about the cfe-commits
mailing list