[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 8 01:48:55 PDT 2025


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 HEAD~1 HEAD --extensions cpp,c -- clang/lib/CodeGen/CGExprScalar.cpp clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index f496ab6d8..df793a5a4 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -4187,7 +4187,7 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF,
     if (CGF.getLangOpts().PointerOverflowDefined ||
         !CGF.SanOpts.has(SanitizerKind::PointerOverflow) ||
         NullPointerIsDefined(CGF.Builder.GetInsertBlock()->getParent(),
-                              PtrTy->getPointerAddressSpace()))
+                             PtrTy->getPointerAddressSpace()))
       return Ptr;
     // The inbounds GEP of null is valid iff the index is zero.
     CodeGenFunction::SanitizerScope SanScope(&CGF);

``````````

</details>


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


More information about the cfe-commits mailing list