clang 22.0.0git
clang::consumed::ConsumedStateMap Class Reference

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

Public Member Functions

 ConsumedStateMap ()=default
 ConsumedStateMap (const ConsumedStateMap &Other)
ConsumedStateMapoperator= (const ConsumedStateMap &)=delete
void checkParamsForReturnTypestate (SourceLocation BlameLoc, ConsumedWarningsHandlerBase &WarningsHandler) const
 Warn if any of the parameters being tracked are not in the state they were declared to be in upon return from a function.
void clearTemporaries ()
 Clear the TmpMap.
ConsumedState getState (const VarDecl *Var) const
 Get the consumed state of a given variable.
ConsumedState getState (const CXXBindTemporaryExpr *Tmp) const
 Get the consumed state of a given temporary value.
void intersect (const ConsumedStateMap &Other)
 Merge this state map with another map.
void intersectAtLoopHead (const CFGBlock *LoopHead, const CFGBlock *LoopBack, const ConsumedStateMap *LoopBackStates, ConsumedWarningsHandlerBase &WarningsHandler)
bool isReachable () const
 Return true if this block is reachable.
void markUnreachable ()
 Mark the block as unreachable.
void setSource (const Stmt *Source)
 Set the source for a decision about the branching of states.
void setState (const VarDecl *Var, ConsumedState State)
 Set the consumed state of a given variable.
void setState (const CXXBindTemporaryExpr *Tmp, ConsumedState State)
 Set the consumed state of a given temporary value.
void remove (const CXXBindTemporaryExpr *Tmp)
 Remove the temporary value from our state map.
bool operator!= (const ConsumedStateMap *Other) const
 Tests to see if there is a mismatch in the states stored in two maps.

Protected Attributes

bool Reachable = true
const StmtFrom = nullptr
VarMapType VarMap
TmpMapType TmpMap

Detailed Description

Definition at line 142 of file Consumed.h.

Constructor & Destructor Documentation

◆ ConsumedStateMap() [1/2]

clang::consumed::ConsumedStateMap::ConsumedStateMap ( )
default

◆ ConsumedStateMap() [2/2]

clang::consumed::ConsumedStateMap::ConsumedStateMap ( const ConsumedStateMap & Other)
inline

Definition at line 155 of file Consumed.h.

References ConsumedStateMap(), From, clang::Other, Reachable, and VarMap.

Member Function Documentation

◆ checkParamsForReturnTypestate()

void ConsumedStateMap::checkParamsForReturnTypestate ( SourceLocation BlameLoc,
ConsumedWarningsHandlerBase & WarningsHandler ) const

Warn if any of the parameters being tracked are not in the state they were declared to be in upon return from a function.

Definition at line 1082 of file Consumed.cpp.

References clang::cast(), clang::isa(), mapReturnTypestateAttrState(), stateToString(), VarMap, and clang::consumed::ConsumedWarningsHandlerBase::warnParamReturnTypestateMismatch().

◆ clearTemporaries()

void ConsumedStateMap::clearTemporaries ( )

Clear the TmpMap.

Definition at line 1102 of file Consumed.cpp.

References TmpMap.

◆ getState() [1/2]

ConsumedState ConsumedStateMap::getState ( const CXXBindTemporaryExpr * Tmp) const

Get the consumed state of a given temporary value.

Definition at line 1116 of file Consumed.cpp.

References clang::consumed::CS_None, and TmpMap.

◆ getState() [2/2]

ConsumedState ConsumedStateMap::getState ( const VarDecl * Var) const

Get the consumed state of a given variable.

Definition at line 1106 of file Consumed.cpp.

References clang::consumed::CS_None, and VarMap.

Referenced by clang::consumed::PropagationInfo::getAsState(), intersect(), intersectAtLoopHead(), operator!=(), splitVarStateForIf(), and splitVarStateForIfBinOp().

◆ intersect()

void ConsumedStateMap::intersect ( const ConsumedStateMap & Other)

Merge this state map with another map.

Definition at line 1125 of file Consumed.cpp.

References ConsumedStateMap(), clang::consumed::CS_None, clang::consumed::CS_Unknown, getState(), markUnreachable(), clang::Other, and VarMap.

◆ intersectAtLoopHead()

void ConsumedStateMap::intersectAtLoopHead ( const CFGBlock * LoopHead,
const CFGBlock * LoopBack,
const ConsumedStateMap * LoopBackStates,
ConsumedWarningsHandlerBase & WarningsHandler )

◆ isReachable()

bool clang::consumed::ConsumedStateMap::isReachable ( ) const
inline

Return true if this block is reachable.

Definition at line 184 of file Consumed.h.

References Reachable.

◆ markUnreachable()

void ConsumedStateMap::markUnreachable ( )

Mark the block as unreachable.

Definition at line 1165 of file Consumed.cpp.

References Reachable, TmpMap, and VarMap.

Referenced by intersect(), splitVarStateForIf(), and splitVarStateForIfBinOp().

◆ operator!=()

bool ConsumedStateMap::operator!= ( const ConsumedStateMap * Other) const

Tests to see if there is a mismatch in the states stored in two maps.

Parameters
Other– The second map to compare against.

Definition at line 1184 of file Consumed.cpp.

References ConsumedStateMap(), getState(), and clang::Other.

◆ operator=()

ConsumedStateMap & clang::consumed::ConsumedStateMap::operator= ( const ConsumedStateMap & )
delete

References ConsumedStateMap(), and clang::Other.

◆ remove()

void ConsumedStateMap::remove ( const CXXBindTemporaryExpr * Tmp)

Remove the temporary value from our state map.

Definition at line 1180 of file Consumed.cpp.

References TmpMap.

◆ setSource()

void clang::consumed::ConsumedStateMap::setSource ( const Stmt * Source)
inline

Set the source for a decision about the branching of states.

Parameters
Source– The statement that was the origin of a branching decision.

Definition at line 192 of file Consumed.h.

◆ setState() [1/2]

void ConsumedStateMap::setState ( const CXXBindTemporaryExpr * Tmp,
ConsumedState State )

Set the consumed state of a given temporary value.

Definition at line 1175 of file Consumed.cpp.

References TmpMap.

◆ setState() [2/2]

void ConsumedStateMap::setState ( const VarDecl * Var,
ConsumedState State )

Set the consumed state of a given variable.

Definition at line 1171 of file Consumed.cpp.

References VarMap.

Referenced by setStateForVarOrTmp(), splitVarStateForIf(), and splitVarStateForIfBinOp().

Member Data Documentation

◆ From

const Stmt* clang::consumed::ConsumedStateMap::From = nullptr
protected

Definition at line 149 of file Consumed.h.

Referenced by ConsumedStateMap().

◆ Reachable

bool clang::consumed::ConsumedStateMap::Reachable = true
protected

Definition at line 148 of file Consumed.h.

Referenced by ConsumedStateMap(), isReachable(), and markUnreachable().

◆ TmpMap

TmpMapType clang::consumed::ConsumedStateMap::TmpMap
protected

Definition at line 151 of file Consumed.h.

Referenced by clearTemporaries(), getState(), markUnreachable(), remove(), and setState().

◆ VarMap

VarMapType clang::consumed::ConsumedStateMap::VarMap
protected

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