[clang] [alpha.webkit.UncountedCallArgsChecker] Don't assume local variables are safe & treat guarded local variable as safe function arguments (PR #82305)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 19 21:04:09 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 d9f9775ac6289271d57671c55166fa0cad61075b 8614a10c5be0e92b2c1005ee38a095a101aa1f63 -- clang/test/Analysis/Checkers/WebKit/guarded-uncounted-obj-arg.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp clang/test/Analysis/Checkers/WebKit/mock-types.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
index 4597dd4b06..774410d1c0 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
@@ -195,21 +195,18 @@ bool isRefcountedStringsHack(const VarDecl *V) {
return false;
}
-bool isVarDeclGuardedInit(const VarDecl *V, const Expr *InitE)
-{
+bool isVarDeclGuardedInit(const VarDecl *V, const Expr *InitE) {
// "this" parameter like any other argument is considered safe.
if (isa<CXXThisExpr>(InitE))
return true;
if (auto *Ref = llvm::dyn_cast<DeclRefExpr>(InitE)) {
- if (auto *MaybeGuardian =
- dyn_cast_or_null<VarDecl>(Ref->getFoundDecl())) {
+ if (auto *MaybeGuardian = dyn_cast_or_null<VarDecl>(Ref->getFoundDecl())) {
// Parameters are guaranteed to be safe for the duration of the call.
if (isa<ParmVarDecl>(MaybeGuardian))
return true;
- const auto *MaybeGuardianArgType =
- MaybeGuardian->getType().getTypePtr();
+ const auto *MaybeGuardianArgType = MaybeGuardian->getType().getTypePtr();
if (!MaybeGuardianArgType)
return false;
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h
index 91865a85b3..5051f4e321 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h
@@ -11,7 +11,6 @@
#include "clang/AST/Type.h"
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/DenseMap.h"
#include <optional>
namespace clang {
``````````
</details>
https://github.com/llvm/llvm-project/pull/82305
More information about the cfe-commits
mailing list