clang 19.0.0git
Public Member Functions | List of all members
clang::CalledOnceCheckHandler Class Reference

#include "clang/Analysis/Analyses/CalledOnceCheck.h"

Public Member Functions

 CalledOnceCheckHandler ()=default
 
virtual ~CalledOnceCheckHandler ()=default
 
virtual void handleDoubleCall (const ParmVarDecl *Parameter, const Expr *Call, const Expr *PrevCall, bool IsCompletionHandler, bool Poised)
 Called when parameter is called twice.
 
virtual void handleNeverCalled (const ParmVarDecl *Parameter, bool IsCompletionHandler)
 Called when parameter is not called at all.
 
virtual void handleCapturedNeverCalled (const ParmVarDecl *Parameter, const Decl *Where, bool IsCompletionHandler)
 Called when captured parameter is not called at all.
 
virtual void handleNeverCalled (const ParmVarDecl *Parameter, const Decl *Function, const Stmt *Where, NeverCalledReason Reason, bool IsCalledDirectly, bool IsCompletionHandler)
 Called when parameter is not called on one of the paths.
 
virtual void handleBlockThatIsGuaranteedToBeCalledOnce (const BlockDecl *Block)
 Called when the block is guaranteed to be called exactly once.
 
virtual void handleBlockWithNoGuarantees (const BlockDecl *Block)
 Called when the block has no guarantees about how many times it can get called.
 

Detailed Description

Definition at line 47 of file CalledOnceCheck.h.

Constructor & Destructor Documentation

◆ CalledOnceCheckHandler()

clang::CalledOnceCheckHandler::CalledOnceCheckHandler ( )
default

◆ ~CalledOnceCheckHandler()

virtual clang::CalledOnceCheckHandler::~CalledOnceCheckHandler ( )
virtualdefault

Member Function Documentation

◆ handleBlockThatIsGuaranteedToBeCalledOnce()

virtual void clang::CalledOnceCheckHandler::handleBlockThatIsGuaranteedToBeCalledOnce ( const BlockDecl Block)
inlinevirtual

Called when the block is guaranteed to be called exactly once.

It means that we can be stricter with what we report on that block.

Parameters
Block– block declaration that is known to be called exactly once.

Definition at line 99 of file CalledOnceCheck.h.

◆ handleBlockWithNoGuarantees()

virtual void clang::CalledOnceCheckHandler::handleBlockWithNoGuarantees ( const BlockDecl Block)
inlinevirtual

Called when the block has no guarantees about how many times it can get called.

It means that we should be more lenient with reporting warnings in it.

Parameters
Block– block declaration in question.

Definition at line 105 of file CalledOnceCheck.h.

◆ handleCapturedNeverCalled()

virtual void clang::CalledOnceCheckHandler::handleCapturedNeverCalled ( const ParmVarDecl Parameter,
const Decl Where,
bool  IsCompletionHandler 
)
inlinevirtual

Called when captured parameter is not called at all.

Parameters
Parameter– parameter that should be called once.
Where– declaration that captures Parameter
IsCompletionHandler– true, if parameter is a completion handler.

Definition at line 73 of file CalledOnceCheck.h.

◆ handleDoubleCall()

virtual void clang::CalledOnceCheckHandler::handleDoubleCall ( const ParmVarDecl Parameter,
const Expr Call,
const Expr PrevCall,
bool  IsCompletionHandler,
bool  Poised 
)
inlinevirtual

Called when parameter is called twice.

Parameters
Parameter– parameter that should be called once.
Call– call to report the warning.
PrevCall– previous call.
IsCompletionHandler– true, if parameter is a completion handler.
Poised– true, if the second call is guaranteed to happen after the first call.

Definition at line 59 of file CalledOnceCheck.h.

◆ handleNeverCalled() [1/2]

virtual void clang::CalledOnceCheckHandler::handleNeverCalled ( const ParmVarDecl Parameter,
bool  IsCompletionHandler 
)
inlinevirtual

Called when parameter is not called at all.

Parameters
Parameter– parameter that should be called once.
IsCompletionHandler– true, if parameter is a completion handler.

Definition at line 66 of file CalledOnceCheck.h.

◆ handleNeverCalled() [2/2]

virtual void clang::CalledOnceCheckHandler::handleNeverCalled ( const ParmVarDecl Parameter,
const Decl Function,
const Stmt Where,
NeverCalledReason  Reason,
bool  IsCalledDirectly,
bool  IsCompletionHandler 
)
inlinevirtual

Called when parameter is not called on one of the paths.

Usually we try to find a statement that is the least common ancestor of the path containing the call and not containing the call. This helps us to pinpoint a bad path for the user.

Parameters
Parameter– parameter that should be called once.
Function– function declaration where the problem occurred.
Where– the least common ancestor statement.
Reason– a reason describing the path without a call.
IsCalledDirectly– true, if parameter actually gets called on the other path. It is opposed to be used in some other way (added to some collection, passed as a parameter, etc.).
IsCompletionHandler– true, if parameter is a completion handler.

Definition at line 89 of file CalledOnceCheck.h.


The documentation for this class was generated from the following file: