diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp | 76 |
1 files changed, 47 insertions, 29 deletions
diff --git a/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp b/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp index 3e5e2b913914..153a1b1acbfa 100644 --- a/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp +++ b/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp @@ -33,30 +33,36 @@ namespace ento { /// checking. /// /// \sa CheckerContext -class CheckerDocumentation : public Checker< check::PreStmt<ReturnStmt>, - check::PostStmt<DeclStmt>, - check::PreObjCMessage, - check::PostObjCMessage, - check::ObjCMessageNil, - check::PreCall, - check::PostCall, - check::BranchCondition, - check::NewAllocator, - check::Location, - check::Bind, - check::DeadSymbols, - check::BeginFunction, - check::EndFunction, - check::EndAnalysis, - check::EndOfTranslationUnit, - eval::Call, - eval::Assume, - check::LiveSymbols, - check::RegionChanges, - check::PointerEscape, - check::ConstPointerEscape, - check::Event<ImplicitNullDerefEvent>, - check::ASTDecl<FunctionDecl> > { +class CheckerDocumentation + : public Checker< + // clang-format off + check::ASTCodeBody, + check::ASTDecl<FunctionDecl>, + check::BeginFunction, + check::Bind, + check::BranchCondition, + check::ConstPointerEscape, + check::DeadSymbols, + check::EndAnalysis, + check::EndFunction, + check::EndOfTranslationUnit, + check::Event<ImplicitNullDerefEvent>, + check::LiveSymbols, + check::Location, + check::NewAllocator, + check::ObjCMessageNil, + check::PointerEscape, + check::PostCall, + check::PostObjCMessage, + check::PostStmt<DeclStmt>, + check::PreCall, + check::PreObjCMessage, + check::PreStmt<ReturnStmt>, + check::RegionChanges, + eval::Assume, + eval::Call + // clang-format on + > { public: /// Pre-visit the Statement. /// @@ -137,10 +143,7 @@ public: /// (2) and (3). Post-call for the allocator is called after step (1). /// Pre-statement for the new-expression is called on step (4) when the value /// of the expression is evaluated. - /// \param NE The C++ new-expression that triggered the allocation. - /// \param Target The allocated region, casted to the class type. - void checkNewAllocator(const CXXNewExpr *NE, SVal Target, - CheckerContext &) const {} + void checkNewAllocator(const CXXAllocatorCall &, CheckerContext &) const {} /// Called on a load from and a store to a location. /// @@ -226,7 +229,7 @@ public: /// first one wins. /// /// eval::Call - bool evalCall(const CallExpr *CE, CheckerContext &C) const { return true; } + bool evalCall(const CallEvent &Call, CheckerContext &C) const { return true; } /// Handles assumptions on symbolic values. /// @@ -324,11 +327,26 @@ public: void checkASTDecl(const FunctionDecl *D, AnalysisManager &Mgr, BugReporter &BR) const {} + + /// Check every declaration that has a statement body in the AST. + /// + /// As AST traversal callback, which should only be used when the checker is + /// not path sensitive. It will be called for every Declaration in the AST. + void checkASTCodeBody(const Decl *D, AnalysisManager &Mgr, + BugReporter &BR) const {} }; void CheckerDocumentation::checkPostStmt(const DeclStmt *DS, CheckerContext &C) const { } +void registerCheckerDocumentationChecker(CheckerManager &Mgr) { + Mgr.registerChecker<CheckerDocumentation>(); +} + +bool shouldRegisterCheckerDocumentationChecker(const CheckerManager &) { + return false; +} + } // end namespace ento } // end namespace clang |