[clang] [Clang] Prevent null pointer dereference in designated initializer check (PR #97220)

via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 30 09:51:57 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 2051736f7bc3fb1a8daaeecc854f93604a590aba 44c309e87d2101b554321741b1c751247a5b6478 -- clang/lib/Sema/SemaExprObjC.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index f943b5f3b5..80e35f79a1 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -3208,7 +3208,7 @@ ExprResult SemaObjC::BuildInstanceMessage(
       const ObjCMethodDecl *InitMethod = nullptr;
       auto *CurMD = SemaRef.getCurMethodDecl();
       if (!CurMD)
-        return ExprResult((Expr*)nullptr);
+        return ExprResult((Expr *)nullptr);
       bool isDesignated =
           CurMD->isDesignatedInitializerForTheInterface(&InitMethod);
       assert(isDesignated && InitMethod);

``````````

</details>


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


More information about the cfe-commits mailing list