[clang] [webkit.RefCntblBaseVirtualDtor] Ignore a base class which has a specialized deref function for a given derived class. (PR #92501)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 16 23:31:08 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 72200fcc346bee1830d9e640e42d717a55acd74c 87cfc8234e1294dedc103b9bcd2b7d9d31874c4a -- clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp
index 36ab581f1e..17e5514850 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp
@@ -49,13 +49,9 @@ class DerefAnalysisVisitor
public:
DerefAnalysisVisitor(const TemplateArgumentList &ArgList,
const CXXRecordDecl *ClassDecl)
- : ArgList(&ArgList)
- , ClassDecl(ClassDecl)
- { }
+ : ArgList(&ArgList), ClassDecl(ClassDecl) {}
- DerefAnalysisVisitor(const CXXRecordDecl *ClassDecl)
- : ClassDecl(ClassDecl)
- { }
+ DerefAnalysisVisitor(const CXXRecordDecl *ClassDecl) : ClassDecl(ClassDecl) {}
bool HasSpecializedDelete(CXXMethodDecl *Decl) {
if (auto *Tmpl = Decl->getTemplateInstantiationPattern())
@@ -128,8 +124,8 @@ public:
bool VisitLambdaExpr(const LambdaExpr *) { return false; }
private:
- const TemplateArgumentList* ArgList { nullptr };
- const CXXRecordDecl* ClassDecl;
+ const TemplateArgumentList *ArgList{nullptr};
+ const CXXRecordDecl *ClassDecl;
llvm::DenseSet<const Stmt *> VisitedBody;
};
@@ -309,11 +305,11 @@ public:
return false;
}
for (auto *MethodDecl : C->methods()) {
- if (safeGetName(MethodDecl) == "deref") {
- DerefAnalysisVisitor DerefAnalysis(DerivedClass);
- if (DerefAnalysis.HasSpecializedDelete(MethodDecl))
- return true;
- }
+ if (safeGetName(MethodDecl) == "deref") {
+ DerefAnalysisVisitor DerefAnalysis(DerivedClass);
+ if (DerefAnalysis.HasSpecializedDelete(MethodDecl))
+ return true;
+ }
}
return false;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/92501
More information about the cfe-commits
mailing list