clang 22.0.0git
|
Enumerations | |
enum | ErrnoCheckState : unsigned { Irrelevant = 0 , MustBeChecked = 1 , MustNotBeChecked = 2 } |
Describe how reads and writes of errno are handled by the checker. More... |
Functions | |
std::optional< SVal > | getErrnoValue (ProgramStateRef State) |
Returns the value of 'errno', if 'errno' was found in the AST. | |
ProgramStateRef | setErrnoValue (ProgramStateRef State, const LocationContext *LCtx, SVal Value, ErrnoCheckState EState) |
Set value of 'errno' to any SVal, if possible. | |
ProgramStateRef | setErrnoValue (ProgramStateRef State, CheckerContext &C, uint64_t Value, ErrnoCheckState EState) |
Set value of 'errno' to a concrete (signed) integer, if possible. | |
std::optional< Loc > | getErrnoLoc (ProgramStateRef State) |
Returns the location that points to the MemoryRegion where the 'errno' value is stored. | |
ErrnoCheckState | getErrnoState (ProgramStateRef State) |
Returns the errno check state, Errno_Irrelevant if 'errno' was not found (this is not the only case for that value). | |
ProgramStateRef | setErrnoState (ProgramStateRef State, ErrnoCheckState EState) |
Set the errno check state, do not modify the errno value. | |
ProgramStateRef | clearErrnoState (ProgramStateRef State) |
Clear state of errno (make it irrelevant). | |
bool | isErrnoLocationCall (const CallEvent &Call) |
Determine if Call is a call to an internal function that returns the location of errno (in environments where errno is accessed this way). | |
const NoteTag * | getErrnoNoteTag (CheckerContext &C, const std::string &Message) |
Create a NoteTag that displays the message if the 'errno' memory region is marked as interesting, and resets the interestingness. | |
ProgramStateRef | setErrnoForStdSuccess (ProgramStateRef State, CheckerContext &C) |
Set errno state for the common case when a standard function is successful. | |
ProgramStateRef | setErrnoForStdFailure (ProgramStateRef State, CheckerContext &C, NonLoc ErrnoSym) |
Set errno state for the common case when a standard function fails. | |
ProgramStateRef | setErrnoStdMustBeChecked (ProgramStateRef State, CheckerContext &C, ConstCFGElementRef Elem) |
Set errno state for the common case when a standard function indicates failure only by errno . |
Describe how reads and writes of errno
are handled by the checker.
Enumerator | |
---|---|
Irrelevant | We do not know anything about 'errno'. Read and write is always allowed. |
MustBeChecked | Value of 'errno' should be checked to find out if a previous function call has failed. When this state is set |
MustNotBeChecked | Value of 'errno' is not allowed to be read, it can contain an unspecified value. When this state is set |
Definition at line 26 of file ErrnoModeling.h.
ProgramStateRef clang::ento::errno_modeling::clearErrnoState | ( | ProgramStateRef | State | ) |
Clear state of errno (make it irrelevant).
Definition at line 218 of file ErrnoModeling.cpp.
References clearErrnoState(), Irrelevant, and setErrnoState().
Referenced by clearErrnoState().
std::optional< Loc > clang::ento::errno_modeling::getErrnoLoc | ( | ProgramStateRef | State | ) |
Returns the location that points to the MemoryRegion
where the 'errno' value is stored.
Returns std::nullopt
if 'errno' was not found. Otherwise it always returns a valid memory region in the system global memory space.
Definition at line 203 of file ErrnoModeling.cpp.
References getErrnoLoc().
Referenced by getErrnoLoc().
const NoteTag * clang::ento::errno_modeling::getErrnoNoteTag | ( | CheckerContext & | C, |
const std::string & | Message ) |
Create a NoteTag that displays the message if the 'errno' memory region is marked as interesting, and resets the interestingness.
Definition at line 226 of file ErrnoModeling.cpp.
References clang::C, getErrnoNoteTag(), clang::ento::PathSensitiveBugReport::getErrorNode(), clang::ento::ExplodedNode::getState(), clang::ento::PathSensitiveBugReport::isInteresting(), and clang::ento::PathSensitiveBugReport::markNotInteresting().
Referenced by getErrnoNoteTag().
ErrnoCheckState clang::ento::errno_modeling::getErrnoState | ( | ProgramStateRef | State | ) |
Returns the errno check state, Errno_Irrelevant
if 'errno' was not found (this is not the only case for that value).
Definition at line 210 of file ErrnoModeling.cpp.
References getErrnoState().
Referenced by getErrnoState().
std::optional< SVal > clang::ento::errno_modeling::getErrnoValue | ( | ProgramStateRef | State | ) |
Returns the value of 'errno', if 'errno' was found in the AST.
Definition at line 171 of file ErrnoModeling.cpp.
References getErrnoValue().
Referenced by getErrnoValue().
Determine if Call is a call to an internal function that returns the location of errno (in environments where errno is accessed this way).
Definition at line 222 of file ErrnoModeling.cpp.
References isErrnoLocationCall().
Referenced by isErrnoLocationCall().
ProgramStateRef clang::ento::errno_modeling::setErrnoForStdFailure | ( | ProgramStateRef | State, |
CheckerContext & | C, | ||
NonLoc | ErrnoSym ) |
Set errno state for the common case when a standard function fails.
Set errno
value to be not equal to zero and ErrnoCheckState
to Irrelevant
. The irrelevant errno state ensures that no related bug report is emitted later and no note tag is needed.
ErrnoSym
Value to be used for errno
and constrained to be non-zero. Definition at line 242 of file ErrnoModeling.cpp.
References clang::C, clang::ento::SVal::castAs(), clang::Cond, clang::ento::SValBuilder::evalBinOp(), clang::ento::SValBuilder::getConditionType(), Irrelevant, clang::ento::SValBuilder::makeZeroVal(), setErrnoForStdFailure(), and setErrnoValue().
Referenced by setErrnoForStdFailure().
ProgramStateRef clang::ento::errno_modeling::setErrnoForStdSuccess | ( | ProgramStateRef | State, |
CheckerContext & | C ) |
Set errno state for the common case when a standard function is successful.
Set ErrnoCheckState
to MustNotBeChecked
(the errno
value is not affected).
Definition at line 237 of file ErrnoModeling.cpp.
References clang::C, MustNotBeChecked, setErrnoForStdSuccess(), and setErrnoState().
Referenced by setErrnoForStdSuccess().
ProgramStateRef clang::ento::errno_modeling::setErrnoState | ( | ProgramStateRef | State, |
ErrnoCheckState | EState ) |
Set the errno check state, do not modify the errno value.
Definition at line 214 of file ErrnoModeling.cpp.
References setErrnoState().
Referenced by clearErrnoState(), setErrnoForStdSuccess(), setErrnoState(), setErrnoStateIrrelevant(), and setErrnoStdMustBeChecked().
ProgramStateRef clang::ento::errno_modeling::setErrnoStdMustBeChecked | ( | ProgramStateRef | State, |
CheckerContext & | C, | ||
ConstCFGElementRef | Elem ) |
Set errno state for the common case when a standard function indicates failure only by errno
.
Sets ErrnoCheckState
to MustBeChecked
, and invalidates the errno region (clear of previous value).
Elem
CFG Element that causes invalidation of errno
. Definition at line 255 of file ErrnoModeling.cpp.
References clang::C, MustBeChecked, setErrnoState(), and setErrnoStdMustBeChecked().
Referenced by setErrnoStdMustBeChecked().
ProgramStateRef clang::ento::errno_modeling::setErrnoValue | ( | ProgramStateRef | State, |
CheckerContext & | C, | ||
uint64_t | Value, | ||
ErrnoCheckState | EState ) |
Set value of 'errno' to a concrete (signed) integer, if possible.
The errno check state is set always when the 'errno' value is set.
Definition at line 191 of file ErrnoModeling.cpp.
References clang::C, and setErrnoValue().
ProgramStateRef clang::ento::errno_modeling::setErrnoValue | ( | ProgramStateRef | State, |
const LocationContext * | LCtx, | ||
SVal | Value, | ||
ErrnoCheckState | EState ) |
Set value of 'errno' to any SVal, if possible.
The errno check state is set always when the 'errno' value is set.
Definition at line 179 of file ErrnoModeling.cpp.
References setErrnoValue().
Referenced by setErrnoForStdFailure(), setErrnoValue(), and setErrnoValue().