[clang] [-Wunsafe-buffer-usage] Fix false positives in warning againt 2-parameter std::span constructor (PR #115797)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 11 17:28:32 PST 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 b816c2628919de9a978132347f039ad23794837d a60c18973c0ea5b59c7c5f38813083e862f70e6e --extensions cpp -- clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-in-container-span-construct.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index 507e61564f..ae6863fb7c 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -411,9 +411,10 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) {
return Arg1CV && Arg1CV->isOne();
break;
case Stmt::CallExprClass:
- if(const auto *CE = dyn_cast<CallExpr>(Arg0)) {
+ if (const auto *CE = dyn_cast<CallExpr>(Arg0)) {
const auto FnDecl = CE->getDirectCallee();
- if(FnDecl && FnDecl->getNameAsString() == "addressof" && FnDecl->isInStdNamespace()) {
+ if (FnDecl && FnDecl->getNameAsString() == "addressof" &&
+ FnDecl->isInStdNamespace()) {
return Arg1CV && Arg1CV->isOne();
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/115797
More information about the cfe-commits
mailing list