clang 20.0.0git
Functions
StreamChecker.cpp File Reference
#include "NoOwnershipChangeVisitor.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.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/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
#include "llvm/ADT/Sequence.h"
#include <functional>
#include <optional>

Go to the source code of this file.

Functions

static std::optional< int64_t > getKnownValue (ProgramStateRef State, SVal V)
 
static ProgramStateRef escapeByStartIndexAndCount (ProgramStateRef State, const CallEvent &Call, unsigned BlockCount, const SubRegion *Buffer, QualType ElemType, int64_t StartIndex, int64_t ElementCount)
 Invalidate only the requested elements instead of the whole buffer.
 
static ProgramStateRef escapeArgs (ProgramStateRef State, CheckerContext &C, const CallEvent &Call, ArrayRef< unsigned int > EscapingArgs)
 
static QualType getPointeeType (const MemRegion *R)
 
static std::optional< NonLocgetStartIndex (SValBuilder &SVB, const MemRegion *R)
 
static ProgramStateRef tryToInvalidateFReadBufferByElements (ProgramStateRef State, CheckerContext &C, const CallEvent &Call, NonLoc SizeVal, NonLoc NMembVal)
 
static const VarDeclgetGlobalStreamPointerByName (const TranslationUnitDecl *TU, StringRef VarName)
 

Function Documentation

◆ escapeArgs()

static ProgramStateRef escapeArgs ( ProgramStateRef  State,
CheckerContext C,
const CallEvent Call,
ArrayRef< unsigned int EscapingArgs 
)
static

Definition at line 866 of file StreamChecker.cpp.

References clang::C, and clang::Call.

◆ escapeByStartIndexAndCount()

static ProgramStateRef escapeByStartIndexAndCount ( ProgramStateRef  State,
const CallEvent Call,
unsigned  BlockCount,
const SubRegion Buffer,
QualType  ElemType,
int64_t  StartIndex,
int64_t  ElementCount 
)
static

Invalidate only the requested elements instead of the whole buffer.

This is basically a refinement of the more generic 'escapeArgs' or the plain old 'invalidateRegions'.

Definition at line 836 of file StreamChecker.cpp.

References clang::Call, clang::ento::SubRegion::getMemRegionManager(), clang::ento::SValBuilder::makeArrayIndex(), and clang::ento::RegionAndSymbolInvalidationTraits::setTrait().

Referenced by tryToInvalidateFReadBufferByElements().

◆ getGlobalStreamPointerByName()

static const VarDecl * getGlobalStreamPointerByName ( const TranslationUnitDecl TU,
StringRef  VarName 
)
static

◆ getKnownValue()

static std::optional< int64_t > getKnownValue ( ProgramStateRef  State,
SVal  V 
)
static

◆ getPointeeType()

static QualType getPointeeType ( const MemRegion R)
static

Definition at line 1076 of file StreamChecker.cpp.

Referenced by clang::Sema::ActOnCXXDelete(), clang::Sema::BuildCallToMemberFunction(), clang::Sema::BuildFieldReferenceExpr(), clang::Sema::BuildMemberReferenceExpr(), clang::SemaObjC::BuildObjCArrayLiteral(), clang::Sema::canCalleeThrow(), checkArithmeticOnObjCPointer(), clang::Sema::CheckAssignmentConstraints(), clang::Sema::CheckCompareOperands(), checkConditionalObjectPointersCompatibility(), checkConditionalPointerCompatibility(), checkObjCPointerTypesForAssignment(), clang::checkSwiftAsyncErrorBlock(), clang::Sema::CheckUnresolvedMemberAccess(), CompareDerivedToBaseConversions(), clang::ConversionFixItGenerator::compareTypesSimple(), computeCachedProperties(), clang::LinkageComputer::computeTypeLinkageInfo(), clang::Sema::CreateBuiltinArraySubscriptExpr(), clang::Sema::DefineImplicitMoveAssignment(), DiagnoseCallingConvCast(), diagnoseListInit(), emitPointerArithmetic(), emitWritebackArg(), encodeTypeForFunctionPointerAuth(), clang::SourceLocExpr::EvaluateInContext(), evaluateLValueAsAllocSize(), clang::Expr::findBoundMemberType(), clang::SemaObjC::FindCompositeObjCPointerType(), clang::CXXNewExpr::getAllocatedType(), clang::CXXDeleteExpr::getDestroyedType(), clang::Decl::getFunctionType(), clang::UnresolvedMemberExpr::getNamingClass(), clang::ASTContext::getObjCEncodingForBlock(), clang::AtomicExpr::getValueType(), clang::ASTContext::getVariableArrayDecayedType(), clang::SemaSwift::handleAsyncAttr(), clang::CompletionContextHandler::handleDeclaration(), handleSentinelAttr(), isDesignatorAtObjectEnd(), clang::Sema::IsFunctionConversion(), clang::SemaOpenMP::isOpenMPCapturedByRef(), IsStructurallyEquivalent(), MarkUsedTemplateParameters(), clang::ASTContext::mergeObjCGCQualifiers(), clang::Sema::MergeTypedefNameDecl(), clang::ASTContext::mergeTypes(), clang::Sema::MergeVarDeclExceptionSpecs(), clang::Sema::PerformImplicitConversion(), clang::PointerType::Profile(), clang::BlockPointerType::Profile(), clang::MemberPointerType::Profile(), clang::ObjCObjectPointerType::Profile(), clang::DependentAddressSpaceType::Profile(), clang::TreeTransform< Derived >::RebuildMemberExpr(), setObjCGCLValueClass(), TryListConversion(), TryReferenceInit(), TryReferenceInitialization(), TryReferenceListInitialization(), TryRefInitWithConversionFunction(), and tryToInvalidateFReadBufferByElements().

◆ getStartIndex()

static std::optional< NonLoc > getStartIndex ( SValBuilder SVB,
const MemRegion R 
)
static

◆ tryToInvalidateFReadBufferByElements()

static ProgramStateRef tryToInvalidateFReadBufferByElements ( ProgramStateRef  State,
CheckerContext C,
const CallEvent Call,
NonLoc  SizeVal,
NonLoc  NMembVal 
)
static