10b57cec5SDimitry Andric //===- CheckerDocumentation.cpp - Documentation checker ---------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This checker lists all the checker callbacks and provides documentation for
100b57cec5SDimitry Andric // checker writers.
110b57cec5SDimitry Andric //
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric
140b57cec5SDimitry Andric #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
150b57cec5SDimitry Andric #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
160b57cec5SDimitry Andric #include "clang/StaticAnalyzer/Core/Checker.h"
170b57cec5SDimitry Andric #include "clang/StaticAnalyzer/Core/CheckerManager.h"
180b57cec5SDimitry Andric #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
190b57cec5SDimitry Andric #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
200b57cec5SDimitry Andric
210b57cec5SDimitry Andric using namespace clang;
220b57cec5SDimitry Andric using namespace ento;
230b57cec5SDimitry Andric
240b57cec5SDimitry Andric // All checkers should be placed into anonymous namespace.
250b57cec5SDimitry Andric // We place the CheckerDocumentation inside ento namespace to make the
260b57cec5SDimitry Andric // it visible in doxygen.
270b57cec5SDimitry Andric namespace clang {
280b57cec5SDimitry Andric namespace ento {
290b57cec5SDimitry Andric
300b57cec5SDimitry Andric /// This checker documents the callback functions checkers can use to implement
310b57cec5SDimitry Andric /// the custom handling of the specific events during path exploration as well
320b57cec5SDimitry Andric /// as reporting bugs. Most of the callbacks are targeted at path-sensitive
330b57cec5SDimitry Andric /// checking.
340b57cec5SDimitry Andric ///
350b57cec5SDimitry Andric /// \sa CheckerContext
36*0fca6ea1SDimitry Andric class CheckerDocumentation
37*0fca6ea1SDimitry Andric : public Checker<
38*0fca6ea1SDimitry Andric // clang-format off
39*0fca6ea1SDimitry Andric check::ASTCodeBody,
40*0fca6ea1SDimitry Andric check::ASTDecl<FunctionDecl>,
410b57cec5SDimitry Andric check::BeginFunction,
42*0fca6ea1SDimitry Andric check::Bind,
43*0fca6ea1SDimitry Andric check::BranchCondition,
440b57cec5SDimitry Andric check::ConstPointerEscape,
45*0fca6ea1SDimitry Andric check::DeadSymbols,
46*0fca6ea1SDimitry Andric check::EndAnalysis,
47*0fca6ea1SDimitry Andric check::EndFunction,
48*0fca6ea1SDimitry Andric check::EndOfTranslationUnit,
490b57cec5SDimitry Andric check::Event<ImplicitNullDerefEvent>,
50*0fca6ea1SDimitry Andric check::LiveSymbols,
51*0fca6ea1SDimitry Andric check::Location,
52*0fca6ea1SDimitry Andric check::NewAllocator,
53*0fca6ea1SDimitry Andric check::ObjCMessageNil,
54*0fca6ea1SDimitry Andric check::PointerEscape,
55*0fca6ea1SDimitry Andric check::PostCall,
56*0fca6ea1SDimitry Andric check::PostObjCMessage,
57*0fca6ea1SDimitry Andric check::PostStmt<DeclStmt>,
58*0fca6ea1SDimitry Andric check::PreCall,
59*0fca6ea1SDimitry Andric check::PreObjCMessage,
60*0fca6ea1SDimitry Andric check::PreStmt<ReturnStmt>,
61*0fca6ea1SDimitry Andric check::RegionChanges,
62*0fca6ea1SDimitry Andric eval::Assume,
63*0fca6ea1SDimitry Andric eval::Call
64*0fca6ea1SDimitry Andric // clang-format on
65*0fca6ea1SDimitry Andric > {
660b57cec5SDimitry Andric public:
670b57cec5SDimitry Andric /// Pre-visit the Statement.
680b57cec5SDimitry Andric ///
690b57cec5SDimitry Andric /// The method will be called before the analyzer core processes the
700b57cec5SDimitry Andric /// statement. The notification is performed for every explored CFGElement,
710b57cec5SDimitry Andric /// which does not include the control flow statements such as IfStmt. The
720b57cec5SDimitry Andric /// callback can be specialized to be called with any subclass of Stmt.
730b57cec5SDimitry Andric ///
740b57cec5SDimitry Andric /// See checkBranchCondition() callback for performing custom processing of
750b57cec5SDimitry Andric /// the branching statements.
760b57cec5SDimitry Andric ///
770b57cec5SDimitry Andric /// check::PreStmt<ReturnStmt>
checkPreStmt(const ReturnStmt * DS,CheckerContext & C) const780b57cec5SDimitry Andric void checkPreStmt(const ReturnStmt *DS, CheckerContext &C) const {}
790b57cec5SDimitry Andric
800b57cec5SDimitry Andric /// Post-visit the Statement.
810b57cec5SDimitry Andric ///
820b57cec5SDimitry Andric /// The method will be called after the analyzer core processes the
830b57cec5SDimitry Andric /// statement. The notification is performed for every explored CFGElement,
840b57cec5SDimitry Andric /// which does not include the control flow statements such as IfStmt. The
850b57cec5SDimitry Andric /// callback can be specialized to be called with any subclass of Stmt.
860b57cec5SDimitry Andric ///
870b57cec5SDimitry Andric /// check::PostStmt<DeclStmt>
880b57cec5SDimitry Andric void checkPostStmt(const DeclStmt *DS, CheckerContext &C) const;
890b57cec5SDimitry Andric
900b57cec5SDimitry Andric /// Pre-visit the Objective C message.
910b57cec5SDimitry Andric ///
920b57cec5SDimitry Andric /// This will be called before the analyzer core processes the method call.
930b57cec5SDimitry Andric /// This is called for any action which produces an Objective-C message send,
940b57cec5SDimitry Andric /// including explicit message syntax and property access.
950b57cec5SDimitry Andric ///
960b57cec5SDimitry Andric /// check::PreObjCMessage
checkPreObjCMessage(const ObjCMethodCall & M,CheckerContext & C) const970b57cec5SDimitry Andric void checkPreObjCMessage(const ObjCMethodCall &M, CheckerContext &C) const {}
980b57cec5SDimitry Andric
990b57cec5SDimitry Andric /// Post-visit the Objective C message.
1000b57cec5SDimitry Andric /// \sa checkPreObjCMessage()
1010b57cec5SDimitry Andric ///
1020b57cec5SDimitry Andric /// check::PostObjCMessage
checkPostObjCMessage(const ObjCMethodCall & M,CheckerContext & C) const1030b57cec5SDimitry Andric void checkPostObjCMessage(const ObjCMethodCall &M, CheckerContext &C) const {}
1040b57cec5SDimitry Andric
1050b57cec5SDimitry Andric /// Visit an Objective-C message whose receiver is nil.
1060b57cec5SDimitry Andric ///
1070b57cec5SDimitry Andric /// This will be called when the analyzer core processes a method call whose
1080b57cec5SDimitry Andric /// receiver is definitely nil. In this case, check{Pre/Post}ObjCMessage and
1090b57cec5SDimitry Andric /// check{Pre/Post}Call will not be called.
1100b57cec5SDimitry Andric ///
1110b57cec5SDimitry Andric /// check::ObjCMessageNil
checkObjCMessageNil(const ObjCMethodCall & M,CheckerContext & C) const1120b57cec5SDimitry Andric void checkObjCMessageNil(const ObjCMethodCall &M, CheckerContext &C) const {}
1130b57cec5SDimitry Andric
1140b57cec5SDimitry Andric /// Pre-visit an abstract "call" event.
1150b57cec5SDimitry Andric ///
1160b57cec5SDimitry Andric /// This is used for checkers that want to check arguments or attributed
1170b57cec5SDimitry Andric /// behavior for functions and methods no matter how they are being invoked.
1180b57cec5SDimitry Andric ///
1190b57cec5SDimitry Andric /// Note that this includes ALL cross-body invocations, so if you want to
1200b57cec5SDimitry Andric /// limit your checks to, say, function calls, you should test for that at the
1210b57cec5SDimitry Andric /// beginning of your callback function.
1220b57cec5SDimitry Andric ///
1230b57cec5SDimitry Andric /// check::PreCall
checkPreCall(const CallEvent & Call,CheckerContext & C) const1240b57cec5SDimitry Andric void checkPreCall(const CallEvent &Call, CheckerContext &C) const {}
1250b57cec5SDimitry Andric
1260b57cec5SDimitry Andric /// Post-visit an abstract "call" event.
1270b57cec5SDimitry Andric /// \sa checkPreObjCMessage()
1280b57cec5SDimitry Andric ///
1290b57cec5SDimitry Andric /// check::PostCall
checkPostCall(const CallEvent & Call,CheckerContext & C) const1300b57cec5SDimitry Andric void checkPostCall(const CallEvent &Call, CheckerContext &C) const {}
1310b57cec5SDimitry Andric
1320b57cec5SDimitry Andric /// Pre-visit of the condition statement of a branch (such as IfStmt).
checkBranchCondition(const Stmt * Condition,CheckerContext & Ctx) const1330b57cec5SDimitry Andric void checkBranchCondition(const Stmt *Condition, CheckerContext &Ctx) const {}
1340b57cec5SDimitry Andric
1350b57cec5SDimitry Andric /// Post-visit the C++ operator new's allocation call.
1360b57cec5SDimitry Andric ///
1370b57cec5SDimitry Andric /// Execution of C++ operator new consists of the following phases: (1) call
1380b57cec5SDimitry Andric /// default or overridden operator new() to allocate memory (2) cast the
1390b57cec5SDimitry Andric /// return value of operator new() from void pointer type to class pointer
1400b57cec5SDimitry Andric /// type, (3) assuming that the value is non-null, call the object's
1410b57cec5SDimitry Andric /// constructor over this pointer, (4) declare that the value of the
1420b57cec5SDimitry Andric /// new-expression is this pointer. This callback is called between steps
1430b57cec5SDimitry Andric /// (2) and (3). Post-call for the allocator is called after step (1).
1440b57cec5SDimitry Andric /// Pre-statement for the new-expression is called on step (4) when the value
1450b57cec5SDimitry Andric /// of the expression is evaluated.
checkNewAllocator(const CXXAllocatorCall &,CheckerContext &) const146*0fca6ea1SDimitry Andric void checkNewAllocator(const CXXAllocatorCall &, CheckerContext &) const {}
1470b57cec5SDimitry Andric
1480b57cec5SDimitry Andric /// Called on a load from and a store to a location.
1490b57cec5SDimitry Andric ///
1500b57cec5SDimitry Andric /// The method will be called each time a location (pointer) value is
1510b57cec5SDimitry Andric /// accessed.
1520b57cec5SDimitry Andric /// \param Loc The value of the location (pointer).
1530b57cec5SDimitry Andric /// \param IsLoad The flag specifying if the location is a store or a load.
1540b57cec5SDimitry Andric /// \param S The load is performed while processing the statement.
1550b57cec5SDimitry Andric ///
1560b57cec5SDimitry Andric /// check::Location
checkLocation(SVal Loc,bool IsLoad,const Stmt * S,CheckerContext &) const1570b57cec5SDimitry Andric void checkLocation(SVal Loc, bool IsLoad, const Stmt *S,
1580b57cec5SDimitry Andric CheckerContext &) const {}
1590b57cec5SDimitry Andric
1600b57cec5SDimitry Andric /// Called on binding of a value to a location.
1610b57cec5SDimitry Andric ///
1620b57cec5SDimitry Andric /// \param Loc The value of the location (pointer).
1630b57cec5SDimitry Andric /// \param Val The value which will be stored at the location Loc.
1640b57cec5SDimitry Andric /// \param S The bind is performed while processing the statement S.
1650b57cec5SDimitry Andric ///
1660b57cec5SDimitry Andric /// check::Bind
checkBind(SVal Loc,SVal Val,const Stmt * S,CheckerContext &) const1670b57cec5SDimitry Andric void checkBind(SVal Loc, SVal Val, const Stmt *S, CheckerContext &) const {}
1680b57cec5SDimitry Andric
1690b57cec5SDimitry Andric /// Called whenever a symbol becomes dead.
1700b57cec5SDimitry Andric ///
1710b57cec5SDimitry Andric /// This callback should be used by the checkers to aggressively clean
1720b57cec5SDimitry Andric /// up/reduce the checker state, which is important for reducing the overall
1730b57cec5SDimitry Andric /// memory usage. Specifically, if a checker keeps symbol specific information
1740b57cec5SDimitry Andric /// in the state, it can and should be dropped after the symbol becomes dead.
1750b57cec5SDimitry Andric /// In addition, reporting a bug as soon as the checker becomes dead leads to
1760b57cec5SDimitry Andric /// more precise diagnostics. (For example, one should report that a malloced
1770b57cec5SDimitry Andric /// variable is not freed right after it goes out of scope.)
1780b57cec5SDimitry Andric ///
1790b57cec5SDimitry Andric /// \param SR The SymbolReaper object can be queried to determine which
1800b57cec5SDimitry Andric /// symbols are dead.
1810b57cec5SDimitry Andric ///
1820b57cec5SDimitry Andric /// check::DeadSymbols
checkDeadSymbols(SymbolReaper & SR,CheckerContext & C) const1830b57cec5SDimitry Andric void checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const {}
1840b57cec5SDimitry Andric
1850b57cec5SDimitry Andric
1860b57cec5SDimitry Andric /// Called when the analyzer core starts analyzing a function,
1870b57cec5SDimitry Andric /// regardless of whether it is analyzed at the top level or is inlined.
1880b57cec5SDimitry Andric ///
1890b57cec5SDimitry Andric /// check::BeginFunction
checkBeginFunction(CheckerContext & Ctx) const1900b57cec5SDimitry Andric void checkBeginFunction(CheckerContext &Ctx) const {}
1910b57cec5SDimitry Andric
1920b57cec5SDimitry Andric /// Called when the analyzer core reaches the end of a
1930b57cec5SDimitry Andric /// function being analyzed regardless of whether it is analyzed at the top
1940b57cec5SDimitry Andric /// level or is inlined.
1950b57cec5SDimitry Andric ///
1960b57cec5SDimitry Andric /// check::EndFunction
checkEndFunction(const ReturnStmt * RS,CheckerContext & Ctx) const1970b57cec5SDimitry Andric void checkEndFunction(const ReturnStmt *RS, CheckerContext &Ctx) const {}
1980b57cec5SDimitry Andric
1990b57cec5SDimitry Andric /// Called after all the paths in the ExplodedGraph reach end of path
2000b57cec5SDimitry Andric /// - the symbolic execution graph is fully explored.
2010b57cec5SDimitry Andric ///
2020b57cec5SDimitry Andric /// This callback should be used in cases when a checker needs to have a
2030b57cec5SDimitry Andric /// global view of the information generated on all paths. For example, to
2040b57cec5SDimitry Andric /// compare execution summary/result several paths.
2050b57cec5SDimitry Andric /// See IdempotentOperationChecker for a usage example.
2060b57cec5SDimitry Andric ///
2070b57cec5SDimitry Andric /// check::EndAnalysis
checkEndAnalysis(ExplodedGraph & G,BugReporter & BR,ExprEngine & Eng) const2080b57cec5SDimitry Andric void checkEndAnalysis(ExplodedGraph &G,
2090b57cec5SDimitry Andric BugReporter &BR,
2100b57cec5SDimitry Andric ExprEngine &Eng) const {}
2110b57cec5SDimitry Andric
2120b57cec5SDimitry Andric /// Called after analysis of a TranslationUnit is complete.
2130b57cec5SDimitry Andric ///
2140b57cec5SDimitry Andric /// check::EndOfTranslationUnit
checkEndOfTranslationUnit(const TranslationUnitDecl * TU,AnalysisManager & Mgr,BugReporter & BR) const2150b57cec5SDimitry Andric void checkEndOfTranslationUnit(const TranslationUnitDecl *TU,
2160b57cec5SDimitry Andric AnalysisManager &Mgr,
2170b57cec5SDimitry Andric BugReporter &BR) const {}
2180b57cec5SDimitry Andric
2190b57cec5SDimitry Andric /// Evaluates function call.
2200b57cec5SDimitry Andric ///
2210b57cec5SDimitry Andric /// The analysis core treats all function calls in the same way. However, some
2220b57cec5SDimitry Andric /// functions have special meaning, which should be reflected in the program
2230b57cec5SDimitry Andric /// state. This callback allows a checker to provide domain specific knowledge
2240b57cec5SDimitry Andric /// about the particular functions it knows about.
2250b57cec5SDimitry Andric ///
2260b57cec5SDimitry Andric /// \returns true if the call has been successfully evaluated
2270b57cec5SDimitry Andric /// and false otherwise. Note, that only one checker can evaluate a call. If
2280b57cec5SDimitry Andric /// more than one checker claims that they can evaluate the same call the
2290b57cec5SDimitry Andric /// first one wins.
2300b57cec5SDimitry Andric ///
2310b57cec5SDimitry Andric /// eval::Call
evalCall(const CallEvent & Call,CheckerContext & C) const232*0fca6ea1SDimitry Andric bool evalCall(const CallEvent &Call, CheckerContext &C) const { return true; }
2330b57cec5SDimitry Andric
2340b57cec5SDimitry Andric /// Handles assumptions on symbolic values.
2350b57cec5SDimitry Andric ///
2360b57cec5SDimitry Andric /// This method is called when a symbolic expression is assumed to be true or
2370b57cec5SDimitry Andric /// false. For example, the assumptions are performed when evaluating a
2380b57cec5SDimitry Andric /// condition at a branch. The callback allows checkers track the assumptions
2390b57cec5SDimitry Andric /// performed on the symbols of interest and change the state accordingly.
2400b57cec5SDimitry Andric ///
2410b57cec5SDimitry Andric /// eval::Assume
evalAssume(ProgramStateRef State,SVal Cond,bool Assumption) const2420b57cec5SDimitry Andric ProgramStateRef evalAssume(ProgramStateRef State,
2430b57cec5SDimitry Andric SVal Cond,
2440b57cec5SDimitry Andric bool Assumption) const { return State; }
2450b57cec5SDimitry Andric
2460b57cec5SDimitry Andric /// Allows modifying SymbolReaper object. For example, checkers can explicitly
2470b57cec5SDimitry Andric /// register symbols of interest as live. These symbols will not be marked
2480b57cec5SDimitry Andric /// dead and removed.
2490b57cec5SDimitry Andric ///
2500b57cec5SDimitry Andric /// check::LiveSymbols
checkLiveSymbols(ProgramStateRef State,SymbolReaper & SR) const2510b57cec5SDimitry Andric void checkLiveSymbols(ProgramStateRef State, SymbolReaper &SR) const {}
2520b57cec5SDimitry Andric
2530b57cec5SDimitry Andric /// Called when the contents of one or more regions change.
2540b57cec5SDimitry Andric ///
2550b57cec5SDimitry Andric /// This can occur in many different ways: an explicit bind, a blanket
2560b57cec5SDimitry Andric /// invalidation of the region contents, or by passing a region to a function
2570b57cec5SDimitry Andric /// call whose behavior the analyzer cannot model perfectly.
2580b57cec5SDimitry Andric ///
2590b57cec5SDimitry Andric /// \param State The current program state.
2600b57cec5SDimitry Andric /// \param Invalidated A set of all symbols potentially touched by the change.
2610b57cec5SDimitry Andric /// \param ExplicitRegions The regions explicitly requested for invalidation.
2620b57cec5SDimitry Andric /// For a function call, this would be the arguments. For a bind, this
2630b57cec5SDimitry Andric /// would be the region being bound to.
2640b57cec5SDimitry Andric /// \param Regions The transitive closure of regions accessible from,
2650b57cec5SDimitry Andric /// \p ExplicitRegions, i.e. all regions that may have been touched
2660b57cec5SDimitry Andric /// by this change. For a simple bind, this list will be the same as
2670b57cec5SDimitry Andric /// \p ExplicitRegions, since a bind does not affect the contents of
2680b57cec5SDimitry Andric /// anything accessible through the base region.
2690b57cec5SDimitry Andric /// \param LCtx LocationContext that is useful for getting various contextual
2700b57cec5SDimitry Andric /// info, like callstack, CFG etc.
2710b57cec5SDimitry Andric /// \param Call The opaque call triggering this invalidation. Will be 0 if the
2720b57cec5SDimitry Andric /// change was not triggered by a call.
2730b57cec5SDimitry Andric ///
2740b57cec5SDimitry Andric /// check::RegionChanges
2750b57cec5SDimitry Andric ProgramStateRef
checkRegionChanges(ProgramStateRef State,const InvalidatedSymbols * Invalidated,ArrayRef<const MemRegion * > ExplicitRegions,ArrayRef<const MemRegion * > Regions,const LocationContext * LCtx,const CallEvent * Call) const2760b57cec5SDimitry Andric checkRegionChanges(ProgramStateRef State,
2770b57cec5SDimitry Andric const InvalidatedSymbols *Invalidated,
2780b57cec5SDimitry Andric ArrayRef<const MemRegion *> ExplicitRegions,
2790b57cec5SDimitry Andric ArrayRef<const MemRegion *> Regions,
2800b57cec5SDimitry Andric const LocationContext *LCtx,
2810b57cec5SDimitry Andric const CallEvent *Call) const {
2820b57cec5SDimitry Andric return State;
2830b57cec5SDimitry Andric }
2840b57cec5SDimitry Andric
2850b57cec5SDimitry Andric /// Called when pointers escape.
2860b57cec5SDimitry Andric ///
2870b57cec5SDimitry Andric /// This notifies the checkers about pointer escape, which occurs whenever
2880b57cec5SDimitry Andric /// the analyzer cannot track the symbol any more. For example, as a
2890b57cec5SDimitry Andric /// result of assigning a pointer into a global or when it's passed to a
2900b57cec5SDimitry Andric /// function call the analyzer cannot model.
2910b57cec5SDimitry Andric ///
2920b57cec5SDimitry Andric /// \param State The state at the point of escape.
2930b57cec5SDimitry Andric /// \param Escaped The list of escaped symbols.
2940b57cec5SDimitry Andric /// \param Call The corresponding CallEvent, if the symbols escape as
2950b57cec5SDimitry Andric /// parameters to the given call.
2960b57cec5SDimitry Andric /// \param Kind How the symbols have escaped.
2970b57cec5SDimitry Andric /// \returns Checkers can modify the state by returning a new state.
checkPointerEscape(ProgramStateRef State,const InvalidatedSymbols & Escaped,const CallEvent * Call,PointerEscapeKind Kind) const2980b57cec5SDimitry Andric ProgramStateRef checkPointerEscape(ProgramStateRef State,
2990b57cec5SDimitry Andric const InvalidatedSymbols &Escaped,
3000b57cec5SDimitry Andric const CallEvent *Call,
3010b57cec5SDimitry Andric PointerEscapeKind Kind) const {
3020b57cec5SDimitry Andric return State;
3030b57cec5SDimitry Andric }
3040b57cec5SDimitry Andric
3050b57cec5SDimitry Andric /// Called when const pointers escape.
3060b57cec5SDimitry Andric ///
3070b57cec5SDimitry Andric /// Note: in most cases checkPointerEscape callback is sufficient.
3080b57cec5SDimitry Andric /// \sa checkPointerEscape
checkConstPointerEscape(ProgramStateRef State,const InvalidatedSymbols & Escaped,const CallEvent * Call,PointerEscapeKind Kind) const3090b57cec5SDimitry Andric ProgramStateRef checkConstPointerEscape(ProgramStateRef State,
3100b57cec5SDimitry Andric const InvalidatedSymbols &Escaped,
3110b57cec5SDimitry Andric const CallEvent *Call,
3120b57cec5SDimitry Andric PointerEscapeKind Kind) const {
3130b57cec5SDimitry Andric return State;
3140b57cec5SDimitry Andric }
3150b57cec5SDimitry Andric
3160b57cec5SDimitry Andric /// check::Event<ImplicitNullDerefEvent>
checkEvent(ImplicitNullDerefEvent Event) const3170b57cec5SDimitry Andric void checkEvent(ImplicitNullDerefEvent Event) const {}
3180b57cec5SDimitry Andric
3190b57cec5SDimitry Andric /// Check every declaration in the AST.
3200b57cec5SDimitry Andric ///
3210b57cec5SDimitry Andric /// An AST traversal callback, which should only be used when the checker is
3220b57cec5SDimitry Andric /// not path sensitive. It will be called for every Declaration in the AST and
3230b57cec5SDimitry Andric /// can be specialized to only be called on subclasses of Decl, for example,
3240b57cec5SDimitry Andric /// FunctionDecl.
3250b57cec5SDimitry Andric ///
3260b57cec5SDimitry Andric /// check::ASTDecl<FunctionDecl>
checkASTDecl(const FunctionDecl * D,AnalysisManager & Mgr,BugReporter & BR) const3270b57cec5SDimitry Andric void checkASTDecl(const FunctionDecl *D,
3280b57cec5SDimitry Andric AnalysisManager &Mgr,
3290b57cec5SDimitry Andric BugReporter &BR) const {}
330*0fca6ea1SDimitry Andric
331*0fca6ea1SDimitry Andric /// Check every declaration that has a statement body in the AST.
332*0fca6ea1SDimitry Andric ///
333*0fca6ea1SDimitry Andric /// As AST traversal callback, which should only be used when the checker is
334*0fca6ea1SDimitry Andric /// not path sensitive. It will be called for every Declaration in the AST.
checkASTCodeBody(const Decl * D,AnalysisManager & Mgr,BugReporter & BR) const335*0fca6ea1SDimitry Andric void checkASTCodeBody(const Decl *D, AnalysisManager &Mgr,
336*0fca6ea1SDimitry Andric BugReporter &BR) const {}
3370b57cec5SDimitry Andric };
3380b57cec5SDimitry Andric
checkPostStmt(const DeclStmt * DS,CheckerContext & C) const3390b57cec5SDimitry Andric void CheckerDocumentation::checkPostStmt(const DeclStmt *DS,
3400b57cec5SDimitry Andric CheckerContext &C) const {
3410b57cec5SDimitry Andric }
3420b57cec5SDimitry Andric
registerCheckerDocumentationChecker(CheckerManager & Mgr)343*0fca6ea1SDimitry Andric void registerCheckerDocumentationChecker(CheckerManager &Mgr) {
344*0fca6ea1SDimitry Andric Mgr.registerChecker<CheckerDocumentation>();
345*0fca6ea1SDimitry Andric }
346*0fca6ea1SDimitry Andric
shouldRegisterCheckerDocumentationChecker(const CheckerManager &)347*0fca6ea1SDimitry Andric bool shouldRegisterCheckerDocumentationChecker(const CheckerManager &) {
348*0fca6ea1SDimitry Andric return false;
349*0fca6ea1SDimitry Andric }
350*0fca6ea1SDimitry Andric
3510b57cec5SDimitry Andric } // end namespace ento
3520b57cec5SDimitry Andric } // end namespace clang
353