clang  9.0.0svn
Namespaces | Macros | Functions
IteratorChecker.cpp File Reference
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeMap.h"
#include <utility>
Include dependency graph for IteratorChecker.cpp:

Go to the source code of this file.

Namespaces

 IteratorComparison
 

Macros

#define REGISTER_CHECKER(name)
 

Functions

 REGISTER_MAP_WITH_PROGRAMSTATE (IteratorRegionMap, const MemRegion *, IteratorPosition) REGISTER_MAP_WITH_PROGRAMSTATE(IteratorComparisonMap
 
bool IteratorComparison::isIteratorType (const QualType &Type)
 
bool IteratorComparison::isIterator (const CXXRecordDecl *CRD)
 
bool IteratorComparison::isComparisonOperator (OverloadedOperatorKind OK)
 
bool IteratorComparison::isBeginCall (const FunctionDecl *Func)
 
bool IteratorComparison::isEndCall (const FunctionDecl *Func)
 
bool IteratorComparison::isAssignCall (const FunctionDecl *Func)
 
bool IteratorComparison::isClearCall (const FunctionDecl *Func)
 
bool IteratorComparison::isPushBackCall (const FunctionDecl *Func)
 
bool IteratorComparison::isEmplaceBackCall (const FunctionDecl *Func)
 
bool IteratorComparison::isPopBackCall (const FunctionDecl *Func)
 
bool IteratorComparison::isPushFrontCall (const FunctionDecl *Func)
 
bool IteratorComparison::isEmplaceFrontCall (const FunctionDecl *Func)
 
bool IteratorComparison::isPopFrontCall (const FunctionDecl *Func)
 
bool IteratorComparison::isInsertCall (const FunctionDecl *Func)
 
bool IteratorComparison::isEraseCall (const FunctionDecl *Func)
 
bool IteratorComparison::isEraseAfterCall (const FunctionDecl *Func)
 
bool IteratorComparison::isEmplaceCall (const FunctionDecl *Func)
 
bool IteratorComparison::isAssignmentOperator (OverloadedOperatorKind OK)
 
bool IteratorComparison::isSimpleComparisonOperator (OverloadedOperatorKind OK)
 
bool IteratorComparison::isAccessOperator (OverloadedOperatorKind OK)
 
bool IteratorComparison::isDereferenceOperator (OverloadedOperatorKind OK)
 
bool IteratorComparison::isIncrementOperator (OverloadedOperatorKind OK)
 
bool IteratorComparison::isDecrementOperator (OverloadedOperatorKind OK)
 
bool IteratorComparison::isRandomIncrOrDecrOperator (OverloadedOperatorKind OK)
 
bool IteratorComparison::hasSubscriptOperator (ProgramStateRef State, const MemRegion *Reg)
 
bool IteratorComparison::frontModifiable (ProgramStateRef State, const MemRegion *Reg)
 
bool IteratorComparison::backModifiable (ProgramStateRef State, const MemRegion *Reg)
 
BinaryOperator::Opcode IteratorComparison::getOpcode (const SymExpr *SE)
 
const RegionOrSymbol IteratorComparison::getRegionOrSymbol (const SVal &Val)
 
const ProgramStateRef IteratorComparison::processComparison (ProgramStateRef State, RegionOrSymbol LVal, RegionOrSymbol RVal, bool Equal)
 
const ProgramStateRef IteratorComparison::saveComparison (ProgramStateRef State, const SymExpr *Condition, const SVal &LVal, const SVal &RVal, bool Eq)
 
const IteratorComparison * IteratorComparison::loadComparison (ProgramStateRef State, const SymExpr *Condition)
 
SymbolRef IteratorComparison::getContainerBegin (ProgramStateRef State, const MemRegion *Cont)
 
SymbolRef IteratorComparison::getContainerEnd (ProgramStateRef State, const MemRegion *Cont)
 
ProgramStateRef IteratorComparison::createContainerBegin (ProgramStateRef State, const MemRegion *Cont, const SymbolRef Sym)
 
ProgramStateRef IteratorComparison::createContainerEnd (ProgramStateRef State, const MemRegion *Cont, const SymbolRef Sym)
 
const IteratorPosition * IteratorComparison::getIteratorPosition (ProgramStateRef State, const SVal &Val)
 
const IteratorPosition * IteratorComparison::getIteratorPosition (ProgramStateRef State, RegionOrSymbol RegOrSym)
 
ProgramStateRef IteratorComparison::setIteratorPosition (ProgramStateRef State, const SVal &Val, const IteratorPosition &Pos)
 
ProgramStateRef IteratorComparison::setIteratorPosition (ProgramStateRef State, RegionOrSymbol RegOrSym, const IteratorPosition &Pos)
 
ProgramStateRef IteratorComparison::removeIteratorPosition (ProgramStateRef State, const SVal &Val)
 
ProgramStateRef IteratorComparison::adjustIteratorPosition (ProgramStateRef State, RegionOrSymbol RegOrSym, const IteratorPosition &Pos, bool Equal)
 
ProgramStateRef IteratorComparison::relateIteratorPositions (ProgramStateRef State, const IteratorPosition &Pos1, const IteratorPosition &Pos2, bool Equal)
 
ProgramStateRef IteratorComparison::invalidateAllIteratorPositions (ProgramStateRef State, const MemRegion *Cont)
 
ProgramStateRef IteratorComparison::invalidateAllIteratorPositionsExcept (ProgramStateRef State, const MemRegion *Cont, SymbolRef Offset, BinaryOperator::Opcode Opc)
 
ProgramStateRef IteratorComparison::invalidateIteratorPositions (ProgramStateRef State, SymbolRef Offset, BinaryOperator::Opcode Opc)
 
ProgramStateRef IteratorComparison::invalidateIteratorPositions (ProgramStateRef State, SymbolRef Offset1, BinaryOperator::Opcode Opc1, SymbolRef Offset2, BinaryOperator::Opcode Opc2)
 
ProgramStateRef IteratorComparison::reassignAllIteratorPositions (ProgramStateRef State, const MemRegion *Cont, const MemRegion *NewCont)
 
ProgramStateRef IteratorComparison::reassignAllIteratorPositionsUnless (ProgramStateRef State, const MemRegion *Cont, const MemRegion *NewCont, SymbolRef Offset, BinaryOperator::Opcode Opc)
 
ProgramStateRef IteratorComparison::rebaseSymbolInIteratorPositionsIf (ProgramStateRef State, SValBuilder &SVB, SymbolRef OldSym, SymbolRef NewSym, SymbolRef CondSym, BinaryOperator::Opcode Opc)
 
const ContainerData * IteratorComparison::getContainerData (ProgramStateRef State, const MemRegion *Cont)
 
ProgramStateRef IteratorComparison::setContainerData (ProgramStateRef State, const MemRegion *Cont, const ContainerData &CData)
 
bool IteratorComparison::hasLiveIterators (ProgramStateRef State, const MemRegion *Cont)
 
bool IteratorComparison::isBoundThroughLazyCompoundVal (const Environment &Env, const MemRegion *Reg)
 
bool IteratorComparison::isPastTheEnd (ProgramStateRef State, const IteratorPosition &Pos)
 
bool IteratorComparison::isAheadOfRange (ProgramStateRef State, const IteratorPosition &Pos)
 
bool IteratorComparison::isBehindPastTheEnd (ProgramStateRef State, const IteratorPosition &Pos)
 
bool IteratorComparison::isZero (ProgramStateRef State, const NonLoc &Val)
 
static ProgramStateRef assumeNoOverflow (ProgramStateRef State, SymbolRef Sym, long Scale)
 

Macro Definition Documentation

◆ REGISTER_CHECKER

#define REGISTER_CHECKER (   name)
Value:
void ento::register##name(CheckerManager &Mgr) { \
auto *checker = Mgr.getChecker<IteratorChecker>(); \
checker->ChecksEnabled[IteratorChecker::CK_##name] = true; \
checker->CheckNames[IteratorChecker::CK_##name] = \
Mgr.getCurrentCheckName(); \
} \
\
bool ento::shouldRegister##name(const LangOptions &LO) { \
return true; \
}
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:49

Definition at line 2447 of file IteratorChecker.cpp.

Function Documentation

◆ assumeNoOverflow()

static ProgramStateRef assumeNoOverflow ( ProgramStateRef  State,
SymbolRef  Sym,
long  Scale 
)
static

Definition at line 983 of file IteratorChecker.cpp.

References IteratorComparison::adjustIteratorPosition(), clang::AS_public, IteratorComparison::backModifiable(), compare(), IteratorComparison::createContainerBegin(), IteratorComparison::createContainerEnd(), End, clang::Equal, IteratorComparison::frontModifiable(), clang::Type::getAs(), clang::Type::getAsCXXRecordDecl(), IteratorComparison::getContainerBegin(), IteratorComparison::getContainerData(), IteratorComparison::getContainerEnd(), clang::ento::getDynamicTypeInfo(), clang::NamedDecl::getIdentifier(), IteratorComparison::getIteratorPosition(), clang::IdentifierInfo::getName(), clang::NamedDecl::getName(), clang::FunctionDecl::getNumParams(), IteratorComparison::getOpcode(), clang::FunctionDecl::getParamDecl(), clang::Type::getPointeeType(), IteratorComparison::getRegionOrSymbol(), clang::ValueDecl::getType(), clang::Type::getUnqualifiedDesugaredType(), IteratorComparison::hasLiveIterators(), IteratorComparison::hasSubscriptOperator(), IteratorComparison::invalidateAllIteratorPositions(), IteratorComparison::invalidateAllIteratorPositionsExcept(), IteratorComparison::invalidateIteratorPositions(), IteratorComparison::isAccessOperator(), IteratorComparison::isAheadOfRange(), IteratorComparison::isAssignCall(), IteratorComparison::isAssignmentOperator(), IteratorComparison::isBeginCall(), IteratorComparison::isBehindPastTheEnd(), IteratorComparison::isBoundThroughLazyCompoundVal(), IteratorComparison::isClearCall(), clang::BinaryOperator::isComparisonOp(), IteratorComparison::isComparisonOperator(), IteratorComparison::isDecrementOperator(), IteratorComparison::isDereferenceOperator(), IteratorComparison::isEmplaceBackCall(), IteratorComparison::isEmplaceCall(), IteratorComparison::isEmplaceFrontCall(), IteratorComparison::isEndCall(), IteratorComparison::isEraseAfterCall(), IteratorComparison::isEraseCall(), IteratorComparison::isIncrementOperator(), IteratorComparison::isInsertCall(), IteratorComparison::isIterator(), IteratorComparison::isIteratorType(), IteratorComparison::isPastTheEnd(), clang::Type::isPointerType(), IteratorComparison::isPopBackCall(), IteratorComparison::isPopFrontCall(), IteratorComparison::isPushBackCall(), IteratorComparison::isPushFrontCall(), IteratorComparison::isRandomIncrOrDecrOperator(), clang::Type::isSignedIntegerOrEnumerationType(), IteratorComparison::isSimpleComparisonOperator(), IteratorComparison::isZero(), IteratorComparison::loadComparison(), clang::CXXRecordDecl::methods(), Offset, IteratorComparison::processComparison(), IteratorComparison::reassignAllIteratorPositions(), IteratorComparison::reassignAllIteratorPositionsUnless(), IteratorComparison::rebaseSymbolInIteratorPositionsIf(), IteratorComparison::relateIteratorPositions(), IteratorComparison::removeIteratorPosition(), IteratorComparison::saveComparison(), IteratorComparison::setContainerData(), IteratorComparison::setIteratorPosition(), and State.

◆ REGISTER_MAP_WITH_PROGRAMSTATE()

REGISTER_MAP_WITH_PROGRAMSTATE ( IteratorRegionMap  ,
const MemRegion *  ,
IteratorPosition   
)