[clang] [NFC][Clang] Fix static analyzer bugs with dereference after null checks (PR #86018)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 20 15:03:40 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 de0abc0983d355bbd971c5c571ba4c209a0c63ea 09ec2dd51e2decb76c1e8f6ea5a505016fa319d9 -- clang/lib/CodeGen/CGOpenMPRuntime.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index e89a5368fb..166f84d948 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -7431,9 +7431,9 @@ private:
           if (!PartialStruct.Base.isValid()) {
             PartialStruct.LowestElem = {FieldIndex, LowestElem};
             if (IsFinalArraySection) {
-              Address HB = OASE &&
-                  CGF.EmitOMPArraySectionExpr(OASE, /*IsLowerBound=*/false)
-                      .getAddress(CGF);
+              Address HB = OASE && CGF.EmitOMPArraySectionExpr(
+                                          OASE, /*IsLowerBound=*/false)
+                                       .getAddress(CGF);
               PartialStruct.HighestElem = {FieldIndex, HB};
             } else {
               PartialStruct.HighestElem = {FieldIndex, LowestElem};
@@ -7444,9 +7444,9 @@ private:
             PartialStruct.LowestElem = {FieldIndex, LowestElem};
           } else if (FieldIndex > PartialStruct.HighestElem.first) {
             if (IsFinalArraySection) {
-              Address HB = OASE &&
-                  CGF.EmitOMPArraySectionExpr(OASE, /*IsLowerBound=*/false)
-                      .getAddress(CGF);
+              Address HB = OASE && CGF.EmitOMPArraySectionExpr(
+                                          OASE, /*IsLowerBound=*/false)
+                                       .getAddress(CGF);
               PartialStruct.HighestElem = {FieldIndex, HB};
             } else {
               PartialStruct.HighestElem = {FieldIndex, LowestElem};

``````````

</details>


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


More information about the cfe-commits mailing list