clang 10.0.0git

Functions
CastValueChecker.cpp File Reference
`#include "clang/AST/DeclTemplate.h"`
`#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"`
`#include "clang/StaticAnalyzer/Core/Checker.h"`
`#include "clang/StaticAnalyzer/Core/CheckerManager.h"`
`#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"`
`#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"`
`#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h"`
`#include "llvm/ADT/Optional.h"`
`#include <utility>`
Include dependency graph for CastValueChecker.cpp:

Go to the source code of this file.

## Functions
static bool | isInfeasibleCast (const DynamicCastInfo *CastInfo, bool CastSucceeds)
static const NoteTag * | getNoteTag (CheckerContext &C, const DynamicCastInfo *CastInfo, QualType CastToTy, const Expr *Object, bool CastSucceeds, bool IsKnownCast)
static QualType | alignReferenceTypes (QualType toAlign, QualType alignTowards, ASTContext &ACtx)
static void | addCastTransition (const CallEvent &Call, DefinedOrUnknownSVal DV, CheckerContext &C, bool IsNonNullParam, bool IsNonNullReturn, bool IsCheckedCast=false)
static void | addInstanceOfTransition (const CallEvent &Call, DefinedOrUnknownSVal DV, ProgramStateRef State, CheckerContext &C, bool IsInstanceOf)
static void | evalNonNullParamNonNullReturn (const CallEvent &Call, DefinedOrUnknownSVal DV, CheckerContext &C, bool IsCheckedCast=false)
static void | evalNonNullParamNullReturn (const CallEvent &Call, DefinedOrUnknownSVal DV, CheckerContext &C)
static void | evalNullParamNullReturn (const CallEvent &Call, DefinedOrUnknownSVal DV, CheckerContext &C)
static void | evalZeroParamNonNullReturn (const CallEvent &Call, DefinedOrUnknownSVal DV, CheckerContext &C, bool IsCheckedCast=false)
static void | evalZeroParamNullReturn (const CallEvent &Call, DefinedOrUnknownSVal DV, CheckerContext &C)

## Function Documentation

## ◆ addCastTransition()

static void addCastTransition | ( | const CallEvent & | Call,
|  | DefinedOrUnknownSVal | DV,
|  | CheckerContext & | C,
|  | bool | IsNonNullParam,
|  | bool | IsNonNullReturn,
|  | bool | IsCheckedCast = `false`
| ) |  |
| static

Definition at line 155 of file CastValueChecker.cpp.

References alignReferenceTypes(), clang::ento::getDynamicCastInfo(), getNoteTag(), clang::Expr::getType(), isInfeasibleCast(), clang::Type::isPointerType(), clang::Type::isReferenceType(), clang::ento::setDynamicTypeAndCastInfo(), State, and V.

Referenced by evalNonNullParamNonNullReturn(), evalNonNullParamNullReturn(), evalZeroParamNonNullReturn(), and evalZeroParamNullReturn().

## ◆ addInstanceOfTransition()

static void addInstanceOfTransition | ( | const CallEvent & | Call,
|  | DefinedOrUnknownSVal | DV,
|  | ProgramStateRef | State,
|  | CheckerContext & | C,
|  | bool | IsInstanceOf
| ) |  |
| static

Definition at line 216 of file CastValueChecker.cpp.

References alignReferenceTypes(), clang::TemplateArgumentList::get(), clang::TemplateArgument::getAsType(), clang::ento::getDynamicCastInfo(), getNoteTag(), clang::FunctionDecl::getTemplateSpecializationArgs(), isInfeasibleCast(), clang::Type::isPointerType(), clang::Type::isReferenceType(), and clang::ento::setDynamicTypeAndCastInfo().

Referenced by evalZeroParamNullReturn().

## ◆ alignReferenceTypes()

static QualType alignReferenceTypes | ( | QualType | toAlign,
|  | QualType | alignTowards,
|  | ASTContext & | ACtx
| ) |  |
| static

Definition at line 141 of file CastValueChecker.cpp.

References clang::QualType::addConst(), clang::ASTContext::getLValueReferenceType(), clang::ASTContext::getRValueReferenceType(), clang::QualType::isConstQualified(), clang::Type::isLValueReferenceType(), and clang::Type::isRValueReferenceType().

Referenced by addCastTransition(), and addInstanceOfTransition().

## ◆ evalNonNullParamNonNullReturn()

static void evalNonNullParamNonNullReturn | ( | const CallEvent & | Call,
|  | DefinedOrUnknownSVal | DV,
|  | CheckerContext & | C,
|  | bool | IsCheckedCast = `false`
| ) |  |
| static

Definition at line 262 of file CastValueChecker.cpp.

References addCastTransition().

Referenced by evalNullParamNullReturn().

## ◆ evalNonNullParamNullReturn()

static void evalNonNullParamNullReturn | ( | const CallEvent & | Call,
|  | DefinedOrUnknownSVal | DV,
|  | CheckerContext & | C
| ) |  |
| static

Definition at line 270 of file CastValueChecker.cpp.

References addCastTransition().

Referenced by evalNullParamNullReturn().

## ◆ evalNullParamNullReturn()

static void evalNullParamNullReturn | ( | const CallEvent & | Call,
|  | DefinedOrUnknownSVal | DV,
|  | CheckerContext & | C
| ) |  |
| static

Definition at line 277 of file CastValueChecker.cpp.

References evalNonNullParamNonNullReturn(), evalNonNullParamNullReturn(), and State.

## ◆ evalZeroParamNonNullReturn()

static void evalZeroParamNonNullReturn | ( | const CallEvent & | Call,
|  | DefinedOrUnknownSVal | DV,
|  | CheckerContext & | C,
|  | bool | IsCheckedCast = `false`
| ) |  |
| static

Definition at line 319 of file CastValueChecker.cpp.

References addCastTransition().

Referenced by evalZeroParamNullReturn().

## ◆ evalZeroParamNullReturn()

static void evalZeroParamNullReturn | ( | const CallEvent & | Call,
|  | DefinedOrUnknownSVal | DV,
|  | CheckerContext & | C
| ) |  |
| static

Definition at line 327 of file CastValueChecker.cpp.

References addCastTransition(), addInstanceOfTransition(), evalZeroParamNonNullReturn(), clang::XRayInstrKind::Function, clang::FunctionDecl::getTemplateSpecializationArgs(), clang::Type::isPointerType(), and clang::Type::isReferenceType().

## ◆ getNoteTag()

static const NoteTag* getNoteTag | ( | CheckerContext & | C,
|  | const DynamicCastInfo * | CastInfo,
|  | QualType | CastToTy,
|  | const Expr * | Object,
|  | bool | CastSucceeds,
|  | bool | IsKnownCast
| ) |  |
| static

Definition at line 103 of file CastValueChecker.cpp.

References clang::NamedDecl::getNameAsString(), clang::Type::getPointeeCXXRecordDecl(), and clang::Expr::IgnoreParenImpCasts().

Referenced by addCastTransition(), and addInstanceOfTransition().

## ◆ isInfeasibleCast()

static bool isInfeasibleCast | ( | const DynamicCastInfo * | CastInfo,
|  | bool | CastSucceeds
| ) |  |
| static

Definition at line 95 of file CastValueChecker.cpp.

Referenced by addCastTransition(), and addInstanceOfTransition().