class SVal

Declaration

class SVal { /* full declaration omitted */ };

Description

SVal - This represents a symbolic expression, which can be either an L-value or an R-value.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:73

Member Variables

protected const void* Data = nullptr
protected unsigned int Kind = 0
The lowest 2 bits are a BaseKind (0 -- 3). The higher bits are an unsigned "kind" value.

Method Overview

Methods

void Profile(llvm::FoldingSetNodeID& ID) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:114

Parameters

llvm::FoldingSetNodeID& ID

SVal(clang::ento::SVal::BaseKind k,
     const void* D = nullptr)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:93

Parameters

clang::ento::SVal::BaseKind k
const void* D = nullptr

SVal()

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:96

SVal(const void* d,
     bool isLoc,
     unsigned int ValKind)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:90

Parameters

const void* d
bool isLoc
unsigned int ValKind

template <typename T>
T castAs() const

Description

Convert to the specified SVal type, asserting that this SVal is of the desired type.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:100

Templates

T

void dump() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:182

void dumpToStream(llvm::raw_ostream& OS) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:181

Parameters

llvm::raw_ostream& OS

template <typename T>
Optional<T> getAs() const

Description

Convert to the specified SVal type, returning None if this SVal is not of the desired type.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:104

Templates

T

const clang::FunctionDecl* getAsFunctionDecl()
    const

Description

getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a CodeTextRegion wrapping a FunctionDecl, return that FunctionDecl. Otherwise return 0.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:150

const llvm::APSInt* getAsInteger() const

Description

If this SVal is loc::ConcreteInt or nonloc::ConcreteInt, return a pointer to APSInt which is held in it. Otherwise, return nullptr.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:174

clang::ento::SymbolRef getAsLocSymbol(
    bool IncludeBaseRegions = false) const

Description

If this SVal is a location and wraps a symbol, return that SymbolRef. Otherwise return 0. Casts are ignored during lookup.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:158

Parameters

bool IncludeBaseRegions = false
The boolean that controls whether the search should continue to the base regions if the region is not symbolic.

const clang::ento::MemRegion* getAsRegion() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:176

clang::ento::SymbolRef getAsSymbol(
    bool IncludeBaseRegions = false) const

Description

If this SVal wraps a symbol return that SymbolRef. Otherwise, return 0. Casts are ignored during lookup.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:169

Parameters

bool IncludeBaseRegions = false
The boolean that controls whether the search should continue to the base regions if the region is not symbolic.

clang::ento::SVal::BaseKind getBaseKind() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:109

clang::ento::SymbolRef getLocSymbolInBase() const

Description

Get the symbol in the SVal or its base region.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:161

unsigned int getRawKind() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:108

unsigned int getSubKind() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:110

clang::QualType getType(
    const clang::ASTContext&) const

Description

Try to get a reasonable type for the given value.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:207

Parameters

const clang::ASTContext&

Returns

The best approximation of the value type or Null. In theory, all symbolic values should be typed, but this function is still a WIP and might have a few blind spots.

bool isConstant(int I) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:143

Parameters

int I

bool isConstant() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:141

bool isUndef() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:129

bool isUnknown() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:125

bool isUnknownOrUndef() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:133

bool isValid() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:137

bool isZeroConstant() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:145

void printJson(llvm::raw_ostream& Out,
               bool AddQuotes) const

Description

printJson - Pretty-prints in JSON format.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:179

Parameters

llvm::raw_ostream& Out
bool AddQuotes

SymExpr::symbol_iterator symbol_begin() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:184

SymExpr::symbol_iterator symbol_end() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:192