clang 20.0.0git
|
#include "clang/Analysis/Analyses/Consumed.h"
Public Member Functions | |
ConsumedStateMap ()=default | |
ConsumedStateMap (const ConsumedStateMap &Other) | |
ConsumedStateMap & | operator= (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 Stmt * | From = nullptr |
VarMapType | VarMap |
TmpMapType | TmpMap |
Definition at line 142 of file Consumed.h.
|
default |
|
inline |
Definition at line 155 of file Consumed.h.
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 1085 of file Consumed.cpp.
References mapReturnTypestateAttrState(), stateToString(), VarMap, and clang::consumed::ConsumedWarningsHandlerBase::warnParamReturnTypestateMismatch().
Referenced by clang::consumed::ConsumedStmtVisitor::VisitReturnStmt().
void ConsumedStateMap::clearTemporaries | ( | ) |
ConsumedState ConsumedStateMap::getState | ( | const CXXBindTemporaryExpr * | Tmp | ) | const |
Get the consumed state of a given temporary value.
Definition at line 1119 of file Consumed.cpp.
References clang::consumed::CS_None, and TmpMap.
ConsumedState ConsumedStateMap::getState | ( | const VarDecl * | Var | ) | const |
Get the consumed state of a given variable.
Definition at line 1109 of file Consumed.cpp.
References clang::consumed::CS_None, and VarMap.
Referenced by clang::consumed::ConsumedStmtVisitor::checkCallability(), clang::consumed::PropagationInfo::getAsState(), intersect(), intersectAtLoopHead(), operator!=(), splitVarStateForIf(), splitVarStateForIfBinOp(), and clang::consumed::ConsumedStmtVisitor::VisitDeclRefExpr().
void ConsumedStateMap::intersect | ( | const ConsumedStateMap & | Other | ) |
Merge this state map with another map.
Definition at line 1128 of file Consumed.cpp.
References clang::consumed::CS_None, clang::consumed::CS_Unknown, getState(), markUnreachable(), clang::Other, and VarMap.
void ConsumedStateMap::intersectAtLoopHead | ( | const CFGBlock * | LoopHead, |
const CFGBlock * | LoopBack, | ||
const ConsumedStateMap * | LoopBackStates, | ||
ConsumedWarningsHandlerBase & | WarningsHandler | ||
) |
Definition at line 1147 of file Consumed.cpp.
References clang::consumed::CS_None, clang::consumed::CS_Unknown, getLastStmtLoc(), getState(), VarMap, and clang::consumed::ConsumedWarningsHandlerBase::warnLoopStateMismatch().
|
inline |
Return true if this block is reachable.
Definition at line 184 of file Consumed.h.
References Reachable.
void ConsumedStateMap::markUnreachable | ( | ) |
Mark the block as unreachable.
Definition at line 1168 of file Consumed.cpp.
References Reachable, TmpMap, and VarMap.
Referenced by intersect(), splitVarStateForIf(), and splitVarStateForIfBinOp().
bool ConsumedStateMap::operator!= | ( | const ConsumedStateMap * | Other | ) | const |
Tests to see if there is a mismatch in the states stored in two maps.
Other | – The second map to compare against. |
Definition at line 1187 of file Consumed.cpp.
References getState(), and clang::Other.
|
delete |
void ConsumedStateMap::remove | ( | const CXXBindTemporaryExpr * | Tmp | ) |
Remove the temporary value from our state map.
Definition at line 1183 of file Consumed.cpp.
References TmpMap.
|
inline |
Set the source for a decision about the branching of states.
Source | – The statement that was the origin of a branching decision. |
Definition at line 192 of file Consumed.h.
void ConsumedStateMap::setState | ( | const CXXBindTemporaryExpr * | Tmp, |
ConsumedState | State | ||
) |
Set the consumed state of a given temporary value.
Definition at line 1178 of file Consumed.cpp.
References TmpMap.
void ConsumedStateMap::setState | ( | const VarDecl * | Var, |
ConsumedState | State | ||
) |
Set the consumed state of a given variable.
Definition at line 1174 of file Consumed.cpp.
References VarMap.
Referenced by clang::consumed::ConsumedStmtVisitor::handleCall(), setStateForVarOrTmp(), splitVarStateForIf(), splitVarStateForIfBinOp(), clang::consumed::ConsumedStmtVisitor::VisitCXXBindTemporaryExpr(), clang::consumed::ConsumedStmtVisitor::VisitParmVarDecl(), and clang::consumed::ConsumedStmtVisitor::VisitVarDecl().
|
protected |
Definition at line 149 of file Consumed.h.
Definition at line 148 of file Consumed.h.
Referenced by isReachable(), and markUnreachable().
|
protected |
Definition at line 151 of file Consumed.h.
Referenced by clearTemporaries(), getState(), markUnreachable(), remove(), and setState().
|
protected |
Definition at line 150 of file Consumed.h.
Referenced by checkParamsForReturnTypestate(), getState(), intersect(), intersectAtLoopHead(), markUnreachable(), and setState().