Skip to content

Commit c486d90

Browse files
authored
[analyzer][NFC] Document check::ASTCodeBody checker callback (#84160)
Fixes #73764 With this patch, now all the callbacks are demonstrated here.
1 parent a6ee0ad commit c486d90

File tree

1 file changed

+37
-24
lines changed

1 file changed

+37
-24
lines changed

clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,36 @@ namespace ento {
3333
/// checking.
3434
///
3535
/// \sa CheckerContext
36-
class CheckerDocumentation : public Checker< check::PreStmt<ReturnStmt>,
37-
check::PostStmt<DeclStmt>,
38-
check::PreObjCMessage,
39-
check::PostObjCMessage,
40-
check::ObjCMessageNil,
41-
check::PreCall,
42-
check::PostCall,
43-
check::BranchCondition,
44-
check::NewAllocator,
45-
check::Location,
46-
check::Bind,
47-
check::DeadSymbols,
48-
check::BeginFunction,
49-
check::EndFunction,
50-
check::EndAnalysis,
51-
check::EndOfTranslationUnit,
52-
eval::Call,
53-
eval::Assume,
54-
check::LiveSymbols,
55-
check::RegionChanges,
56-
check::PointerEscape,
57-
check::ConstPointerEscape,
58-
check::Event<ImplicitNullDerefEvent>,
59-
check::ASTDecl<FunctionDecl> > {
36+
class CheckerDocumentation
37+
: public Checker<
38+
// clang-format off
39+
check::ASTCodeBody,
40+
check::ASTDecl<FunctionDecl>,
41+
check::BeginFunction,
42+
check::Bind,
43+
check::BranchCondition,
44+
check::ConstPointerEscape,
45+
check::DeadSymbols,
46+
check::EndAnalysis,
47+
check::EndFunction,
48+
check::EndOfTranslationUnit,
49+
check::Event<ImplicitNullDerefEvent>,
50+
check::LiveSymbols,
51+
check::Location,
52+
check::NewAllocator,
53+
check::ObjCMessageNil,
54+
check::PointerEscape,
55+
check::PostCall,
56+
check::PostObjCMessage,
57+
check::PostStmt<DeclStmt>,
58+
check::PreCall,
59+
check::PreObjCMessage,
60+
check::PreStmt<ReturnStmt>,
61+
check::RegionChanges,
62+
eval::Assume,
63+
eval::Call
64+
// clang-format on
65+
> {
6066
public:
6167
/// Pre-visit the Statement.
6268
///
@@ -321,6 +327,13 @@ class CheckerDocumentation : public Checker< check::PreStmt<ReturnStmt>,
321327
void checkASTDecl(const FunctionDecl *D,
322328
AnalysisManager &Mgr,
323329
BugReporter &BR) const {}
330+
331+
/// Check every declaration that has a statement body in the AST.
332+
///
333+
/// As AST traversal callback, which should only be used when the checker is
334+
/// not path sensitive. It will be called for every Declaration in the AST.
335+
void checkASTCodeBody(const Decl *D, AnalysisManager &Mgr,
336+
BugReporter &BR) const {}
324337
};
325338

326339
void CheckerDocumentation::checkPostStmt(const DeclStmt *DS,

0 commit comments

Comments
 (0)