[clang-tools-extra] [clang-tidy] Create bugprone-bit-cast-pointers check (PR #108083)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 10 13:47:59 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 b8b8fbe19dea2825b801c4738ff78dbf26aae430 6916d5ecdc327b2771fbbca226095bd99d394dab --extensions cpp,h -- clang-tools-extra/clang-tidy/bugprone/BitCastPointersCheck.cpp clang-tools-extra/clang-tidy/bugprone/BitCastPointersCheck.h clang-tools-extra/test/clang-tidy/checkers/bugprone/bit-cast-pointers.cpp clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
``````````

</details>

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

``````````diff
diff --git a/clang-tools-extra/clang-tidy/bugprone/BitCastPointersCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/BitCastPointersCheck.cpp
index 4589a35a56..1f5fa9c160 100644
--- a/clang-tools-extra/clang-tidy/bugprone/BitCastPointersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/BitCastPointersCheck.cpp
@@ -24,7 +24,8 @@ void BitCastPointersCheck::registerMatchers(MatchFinder *Finder) {
 
 void BitCastPointersCheck::check(const MatchFinder::MatchResult &Result) {
   if (const auto *MatchedDecl = Result.Nodes.getNodeAs<CallExpr>("x"))
-    diag(MatchedDecl->getBeginLoc(), "do not use std::bit_cast on pointers; use reinterpret_cast instead");
+    diag(MatchedDecl->getBeginLoc(),
+         "do not use std::bit_cast on pointers; use reinterpret_cast instead");
 }
 
 } // namespace clang::tidy::bugprone

``````````

</details>


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


More information about the cfe-commits mailing list