clang  15.0.0git
Namespaces | Functions
ErrnoModeling.cpp File Reference
#include "ErrnoModeling.h"
#include "clang/AST/ParentMapContext.h"
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
#include "llvm/ADT/STLExtras.h"
Include dependency graph for ErrnoModeling.cpp:

Go to the source code of this file.




static const VarDeclgetErrnoVar (ASTContext &ACtx)
 Store a MemRegion that contains the 'errno' integer value. More...
static const FunctionDeclgetErrnoFunc (ASTContext &ACtx)
 Search for a function with a specific name that is used to return a pointer to "errno". More...
Optional< SVal > clang::ento::errno_modeling::getErrnoValue (ProgramStateRef State)
 Returns the value of 'errno', if 'errno' was found in the AST. More...
ProgramStateRef clang::ento::errno_modeling::setErrnoValue (ProgramStateRef State, const LocationContext *LCtx, SVal Value, ErrnoCheckState EState)
 Set value of 'errno' to any SVal, if possible. More...
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. More...
Optional< Loc > clang::ento::errno_modeling::getErrnoLoc (ProgramStateRef State)
 Returns the location that points to the MemoryRegion where the 'errno' value is stored. More...
ProgramStateRef clang::ento::errno_modeling::setErrnoState (ProgramStateRef State, ErrnoCheckState EState)
 Set the errno check state, do not modify the errno value. More...
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). More...
bool clang::ento::errno_modeling::isErrno (const Decl *D)
 Determine if a Decl node related to 'errno'. More...
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. More...

Function Documentation

◆ getErrnoFunc()

static const FunctionDecl* getErrnoFunc ( ASTContext ACtx)

Search for a function with a specific name that is used to return a pointer to "errno".

Return nullptr if no such function was found.

Definition at line 96 of file ErrnoModeling.cpp.

References clang::IdentifierTable::get(), clang::ASTContext::getPointerType(), clang::ASTContext::getSourceManager(), clang::ASTContext::getTranslationUnitDecl(), clang::ASTContext::Idents, clang::ASTContext::IntTy, clang::SourceManager::isInSystemHeader(), and clang::DeclContext::lookup().

◆ getErrnoVar()

static const VarDecl* getErrnoVar ( ASTContext ACtx)

Store a MemRegion that contains the 'errno' integer value.

The value is null if the 'errno' value was not recognized in the AST. Search for a variable called "errno" in the AST. Return nullptr if not found.

Definition at line 77 of file ErrnoModeling.cpp.