clang 20.0.0git
Classes | Functions
UninitializedPointee.cpp File Reference
#include "UninitializedObject.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h"
#include <optional>

Go to the source code of this file.

Classes

struct  DereferenceInfo
 

Functions

static std::optional< DereferenceInfodereference (ProgramStateRef State, const FieldRegion *FR)
 Dereferences FR and returns with the pointee's region, and whether it needs to be casted back to it's location type.
 
static bool isVoidPointer (QualType T)
 Returns whether T can be (transitively) dereferenced to a void pointer type (void*, void**, ...).
 

Function Documentation

◆ dereference()

static std::optional< DereferenceInfo > dereference ( ProgramStateRef  State,
const FieldRegion FR 
)
static

Dereferences FR and returns with the pointee's region, and whether it needs to be casted back to it's location type.

If for whatever reason dereferencing fails, returns std::nullopt.

Definition at line 221 of file UninitializedPointee.cpp.

References clang::ento::MemRegion::getAs(), clang::ento::FieldRegion::getDecl(), clang::ento::TypedValueRegion::getLocationType(), clang::Type::getPointeeType(), clang::ento::SubRegion::getSuperRegion(), clang::ValueDecl::getType(), clang::ento::isDereferencableType(), isVoidPointer(), and V.

◆ isVoidPointer()

static bool isVoidPointer ( QualType  T)
static

Returns whether T can be (transitively) dereferenced to a void pointer type (void*, void**, ...).

Definition at line 274 of file UninitializedPointee.cpp.

References clang::Type::getPointeeType(), clang::Type::isVoidPointerType(), and clang::T.

Referenced by dereference().