clang  15.0.0git
Enumerations | Functions
clang::ento::errno_modeling Namespace Reference

Enumerations

enum  ErrnoCheckState : unsigned { Irrelevant = 0, MustBeChecked = 1, MustNotBeChecked = 2 }
 

Functions

Optional< SValgetErrnoValue (ProgramStateRef State)
 Returns the value of 'errno', if 'errno' was found in the AST. More...
 
ProgramStateRef setErrnoValue (ProgramStateRef State, const LocationContext *LCtx, SVal Value, ErrnoCheckState EState)
 Set value of 'errno' to any SVal, if possible. More...
 
ProgramStateRef setErrnoValue (ProgramStateRef State, CheckerContext &C, uint64_t Value, ErrnoCheckState EState)
 Set value of 'errno' to a concrete (signed) integer, if possible. More...
 
Optional< LocgetErrnoLoc (ProgramStateRef State)
 Returns the location that points to the MemoryRegion where the 'errno' value is stored. More...
 
ProgramStateRef setErrnoState (ProgramStateRef State, ErrnoCheckState EState)
 Set the errno check state, do not modify the errno value. More...
 
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). More...
 
bool isErrno (const Decl *D)
 Determine if a Decl node related to 'errno'. More...
 
const NoteTaggetErrnoNoteTag (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. More...
 

Enumeration Type Documentation

◆ ErrnoCheckState

Enumerator
Irrelevant 

We do not know anything about 'errno'.

MustBeChecked 

Value of 'errno' should be checked to find out if a previous function call has failed.

MustNotBeChecked 

Value of 'errno' is not allowed to be read, it can contain an unspecified value.

Definition at line 24 of file ErrnoModeling.h.

Function Documentation

◆ getErrnoLoc()

llvm::Optional< Loc > clang::ento::errno_modeling::getErrnoLoc ( ProgramStateRef  State)

Returns the location that points to the MemoryRegion where the 'errno' value is stored.

Returns None if 'errno' was not found. Otherwise it always returns a valid memory region in the system global memory space.

Definition at line 242 of file ErrnoModeling.cpp.

References State.

◆ getErrnoNoteTag()

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 267 of file ErrnoModeling.cpp.

References clang::ento::PathSensitiveBugReport::getErrorNode(), clang::ento::PathSensitiveBugReport::isInteresting(), and string().

◆ getErrnoState()

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 253 of file ErrnoModeling.cpp.

References State.

◆ getErrnoValue()

llvm::Optional< SVal > clang::ento::errno_modeling::getErrnoValue ( ProgramStateRef  State)

Returns the value of 'errno', if 'errno' was found in the AST.

Definition at line 210 of file ErrnoModeling.cpp.

References State.

◆ isErrno()

bool clang::ento::errno_modeling::isErrno ( const Decl D)

Determine if a Decl node related to 'errno'.

This is true if the declaration is the errno variable or a function that returns a pointer to the 'errno' value (usually the 'errno' macro is defined with this function). D is not required to be a canonical declaration.

Definition at line 257 of file ErrnoModeling.cpp.

◆ setErrnoState()

ProgramStateRef clang::ento::errno_modeling::setErrnoState ( ProgramStateRef  State,
ErrnoCheckState  EState 
)

Set the errno check state, do not modify the errno value.

Definition at line 249 of file ErrnoModeling.cpp.

References State.

Referenced by setErrnoStateIrrelevant().

◆ setErrnoValue() [1/2]

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 230 of file ErrnoModeling.cpp.

References State.

◆ setErrnoValue() [2/2]

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 218 of file ErrnoModeling.cpp.

References State.