48 #include "llvm/ADT/ArrayRef.h" 49 #include "llvm/ADT/DenseMap.h" 50 #include "llvm/ADT/None.h" 51 #include "llvm/ADT/Optional.h" 52 #include "llvm/ADT/PointerIntPair.h" 53 #include "llvm/ADT/SmallSet.h" 54 #include "llvm/ADT/SmallVector.h" 55 #include "llvm/ADT/StringExtras.h" 56 #include "llvm/ADT/StringRef.h" 57 #include "llvm/Support/Casting.h" 58 #include "llvm/Support/Compiler.h" 59 #include "llvm/Support/Debug.h" 60 #include "llvm/Support/ErrorHandling.h" 61 #include "llvm/Support/raw_ostream.h" 65 #define DEBUG_TYPE "static-analyzer-call-event" 67 using namespace clang;
112 for (
const auto *I : RD->
fields()) {
143 I != E && Idx < NumOfArgs; ++I, ++Idx) {
163 const auto *FD = dyn_cast_or_null<FunctionDecl>(
getDecl());
205 unsigned Idx = 0, Sz = B->
size();
206 for (; Idx < Sz; ++Idx)
207 if (
auto StmtElem = (*B)[Idx].getAs<CFGStmt>())
208 if (StmtElem->getStmt() == E)
223 State->getStateManager().getRegionManager().getVarRegion(PVD, SFC);
253 I != E; ++I, ++Idx) {
255 PreserveArgs.insert(Idx);
265 if (callee->hasAttr<PureAttr>() || callee->hasAttr<ConstAttr>())
274 llvm::SmallSet<unsigned, 4> PreserveArgs;
278 for (
unsigned Idx = 0, Count =
getNumArgs(); Idx != Count; ++Idx) {
281 if (PreserveArgs.count(Idx))
283 ETraits.
setTrait(MR->getBaseRegion(),
287 ValuesToInvalidate.push_back(
getArgSVal(Idx));
293 return Result->invalidateRegions(ValuesToInvalidate,
getOriginExpr(),
296 nullptr,
this, &ETraits);
308 assert(D &&
"Cannot get a program point without a statement or decl");
320 if (!CD.IsLookupDone) {
321 CD.IsLookupDone =
true;
322 CD.II = &
getState()->getStateManager().getContext().Idents.get(CD.FuncName);
325 if (!II || II != CD.II)
369 Out <<
"Unknown call (type " <<
getKind() <<
")";
373 return isa<CallExpr>(S) || isa<ObjCMessageExpr>(S)
374 || isa<CXXConstructExpr>(S)
375 || isa<CXXNewExpr>(S);
380 if (
const auto *FD = dyn_cast<FunctionDecl>(D))
381 return FD->getReturnType();
382 if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D))
383 return MD->getReturnType();
384 if (
const auto *BD = dyn_cast<BlockDecl>(D)) {
396 Ty = FT->getReturnType();
404 llvm_unreachable(
"unknown callable kind");
410 if (
const auto *FD = dyn_cast<FunctionDecl>(D))
411 return FD->isVariadic();
412 if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D))
413 return MD->isVariadic();
414 if (
const auto *BD = dyn_cast<BlockDecl>(D))
415 return BD->isVariadic();
417 llvm_unreachable(
"unknown callable kind");
432 for (; I != E && Idx < NumArgs; ++I, ++Idx) {
434 assert(ParamDecl &&
"Formal parameter has no decl?");
439 Bindings.push_back(std::make_pair(ParamLoc, ArgVal));
462 getManager()->getContext(FD);
463 bool IsAutosynthesized;
466 if (IsAutosynthesized)
467 llvm::dbgs() <<
"Using autosynthesized body for " << FD->
getName()
487 if (!CTUDeclOrError) {
488 handleAllErrors(CTUDeclOrError.takeError(),
501 const auto *D = cast<FunctionDecl>(CalleeCtx->
getDecl());
525 if (II->
isStr(
"pthread_setspecific"))
530 if (II->
isStr(
"xpc_connection_set_context"))
534 if (II->
isStr(
"funopen"))
539 if (II->
isStr(
"__cxa_demangle"))
542 StringRef FName = II->
getName();
546 if (FName.endswith(
"NoCopy"))
551 if (FName.startswith(
"NS") && (FName.find(
"Insert") != StringRef::npos))
556 if (FName.startswith(
"CF") || FName.startswith(
"CG")) {
557 return StrInStrNoCase(FName,
"InsertValue") != StringRef::npos ||
558 StrInStrNoCase(FName,
"AddValue") != StringRef::npos ||
559 StrInStrNoCase(FName,
"SetValue") != StringRef::npos ||
560 StrInStrNoCase(FName,
"WithData") != StringRef::npos ||
561 StrInStrNoCase(FName,
"AppendValue") != StringRef::npos ||
562 StrInStrNoCase(FName,
"SetAttribute") != StringRef::npos;
585 return getSVal(CE->getCallee()).getAsFunctionDecl();
590 SVal ThisVal = getCXXThisVal();
591 Values.push_back(ThisVal);
594 if (
const auto *D = cast_or_null<CXXMethodDecl>(
getDecl())) {
606 assert(ParentRecord);
620 const Expr *
Base = getCXXThisExpr();
637 const auto *MD = cast<CXXMethodDecl>(D);
638 if (!MD->isVirtual())
642 const MemRegion *R = getCXXThisVal().getAsRegion();
653 assert(!RegionType.
isNull() &&
"DynamicTypeInfo should always be a pointer.");
656 if (!RD || !RD->hasDefinition())
660 const CXXMethodDecl *Result = MD->getCorrespondingMethodInClass(RD,
true);
666 assert(!RD->isDerivedFrom(MD->getParent()) &&
"Couldn't find known method");
680 if (!Result->
hasBody(Definition))
697 SVal ThisVal = getCXXThisVal();
702 const auto *MD = cast<CXXMethodDecl>(CalleeCtx->
getDecl());
722 ThisVal = SVB.
evalCast(ThisVal, Ty, StaticTy);
727 Bindings.push_back(std::make_pair(ThisLoc, ThisVal));
740 if (
const auto *ME = dyn_cast<MemberExpr>(
getOriginExpr()->getCallee()))
741 if (ME->hasQualifier())
755 return dyn_cast_or_null<BlockDataRegion>(DataReg);
768 if (
const MemRegion *R = getBlockRegion())
776 if (isConversionFromLambda()) {
777 auto *LambdaOperatorDecl = cast<CXXMethodDecl>(CalleeCtx->
getDecl());
778 Params = LambdaOperatorDecl->parameters();
783 const VarRegion *CapturedLambdaRegion = getRegionStoringCapturedLambda();
786 Bindings.push_back(std::make_pair(ThisLoc, ThisVal));
808 Values.push_back(MV);
817 SVal ThisVal = getCXXThisVal();
820 const auto *MD = cast<CXXMethodDecl>(CalleeCtx->
getDecl());
822 Bindings.push_back(std::make_pair(ThisLoc, ThisVal));
835 if (isBaseDestructor())
855 if (
const ObjCIvarDecl *PropIvar = PropDecl->getPropertyIvarDecl()) {
856 SVal IvarLVal =
getState()->getLValue(PropIvar, getReceiverSVal());
864 Values.push_back(IvarLVal);
870 Values.push_back(getReceiverSVal());
883 if (!isInstanceMessage())
892 SVal SelfVal = getSelfSVal();
893 assert(SelfVal.
isValid() &&
"Calling super but not in ObjC method");
902 if (!isInstanceMessage())
907 return (RecVal == getSelfSVal());
911 switch (getMessageKind()) {
916 return getContainingPseudoObjectExpr()->getSourceRange();
918 llvm_unreachable(
"unknown message kind");
923 const PseudoObjectExpr *ObjCMethodCall::getContainingPseudoObjectExpr()
const {
924 assert(
Data &&
"Lazy lookup not yet performed.");
925 assert(getMessageKind() !=
OCM_Message &&
"Explicit message send.");
926 return ObjCMessageDataTy::getFromOpaqueValue(
Data).getPointer();
935 if (
const auto *BO = dyn_cast<BinaryOperator>(Syntactic))
936 Syntactic = BO->getLHS();
948 if (
const auto *POE = dyn_cast_or_null<PseudoObjectExpr>(S)) {
953 case Stmt::ObjCPropertyRefExprClass:
956 case Stmt::ObjCSubscriptRefExprClass:
968 assert(getMessageKind() == K);
980 if (!Info.getPointer())
989 assert(POE &&
"Property access without PseudoObjectExpr?");
992 auto *RefExpr = cast<ObjCPropertyRefExpr>(Syntactic);
994 if (RefExpr->isExplicitProperty())
995 return RefExpr->getExplicitProperty();
1011 getState()->getStateManager().getOwningEngine()->getAnalysisManager();
1058 llvm_unreachable(
"The while loop should always terminate.");
1069 MD = cast<ObjCMethodDecl>(I);
1081 if (!InstRecIg || !InstRecIg->getFoundDecl() ||
1082 !InstRecIg->getFoundDecl()->getName().equals(
"self"))
1101 bool CanBeSubClassed =
false;
1105 if (!SupersType.
isNull()) {
1109 ReceiverT = cast<ObjCObjectPointerType>(SupersType);
1111 Receiver = getReceiverSVal().getAsRegion();
1117 assert(isa<AllocaRegion>(Receiver) &&
1118 "Unhandled untyped region class!");
1126 if (ReceiverT && CanBeSubClassed)
1128 if (!canBeOverridenInSubclass(IDecl, Sel))
1129 CanBeSubClassed =
false;
1135 if (
auto *PT = dyn_cast_or_null<ObjCObjectPointerType>(ReceiverT)) {
1137 if (PT->getObjectType()->isObjCClass() &&
1138 Receiver == getSelfSVal().getAsRegion())
1174 using PrivateMethodKey = std::pair<const ObjCInterfaceDecl *, Selector>;
1175 using PrivateMethodCache =
1176 llvm::DenseMap<PrivateMethodKey, Optional<const ObjCMethodDecl *>>;
1178 static PrivateMethodCache PMC;
1182 if (!Val.hasValue()) {
1183 Val = IDecl->lookupPrivateMethod(Sel);
1189 if (CompileTimeMD->isPropertyAccessor()) {
1190 if (!CompileTimeMD->getSelfDecl() &&
1191 isa<ObjCCategoryDecl>(CompileTimeMD->getDeclContext())) {
1202 auto *
ID = CompileTimeMD->getClassInterface();
1203 for (
auto *CatDecl :
ID->visible_extensions()) {
1204 Val = CatDecl->getMethod(Sel,
1205 CompileTimeMD->isInstanceMethod());
1211 Val = IDecl->lookupInstanceMethod(Sel);
1216 if (CanBeSubClassed)
1248 const auto *D = cast<ObjCMethodDecl>(CalleeCtx->
getDecl());
1253 SVal SelfVal = getReceiverSVal();
1254 if (!SelfVal.isUnknown()) {
1258 Bindings.push_back(std::make_pair(SelfLoc, SelfVal));
1265 if (
const auto *MCE = dyn_cast<CXXMemberCallExpr>(CE))
1266 return create<CXXMemberCall>(MCE, State, LCtx);
1268 if (
const auto *OpCE = dyn_cast<CXXOperatorCallExpr>(CE)) {
1269 const FunctionDecl *DirectCallee = OpCE->getDirectCallee();
1270 if (
const auto *MD = dyn_cast<CXXMethodDecl>(DirectCallee))
1271 if (MD->isInstance())
1272 return create<CXXMemberOperatorCall>(OpCE, State, LCtx);
1275 return create<BlockCall>(CE, State, LCtx);
1280 return create<SimpleFunctionCall>(CE, State, LCtx);
1288 assert(CallerCtx &&
"This should not be used for top-level stack frames");
1293 if (
const CallExpr *CE = dyn_cast<CallExpr>(CallSite))
1294 return getSimpleCall(CE, State, CallerCtx);
1297 case Stmt::CXXConstructExprClass:
1298 case Stmt::CXXTemporaryObjectExprClass: {
1299 SValBuilder &SVB = State->getStateManager().getSValBuilder();
1300 const auto *Ctor = cast<CXXMethodDecl>(CalleeCtx->
getDecl());
1302 SVal ThisVal = State->getSVal(ThisPtr);
1304 return getCXXConstructorCall(cast<CXXConstructExpr>(CallSite),
1307 case Stmt::CXXNewExprClass:
1308 return getCXXAllocatorCall(cast<CXXNewExpr>(CallSite), State, CallerCtx);
1309 case Stmt::ObjCMessageExprClass:
1310 return getObjCMethodCall(cast<ObjCMessageExpr>(CallSite),
1313 llvm_unreachable(
"This is not an inlineable statement.");
1322 "All other CFG elements should have exprs");
1324 SValBuilder &SVB = State->getStateManager().getSValBuilder();
1325 const auto *Dtor = cast<CXXDestructorDecl>(CalleeCtx->
getDecl());
1327 SVal ThisVal = State->getSVal(ThisPtr);
1329 const Stmt *Trigger;
1331 Trigger = AutoDtor->getTriggerStmt();
1333 Trigger = DeleteDtor->getDeleteExpr();
1335 Trigger = Dtor->getBody();
1337 return getCXXDestructorCall(Dtor, Trigger, ThisVal.
getAsRegion(),
Suppress pointer-escaping of a region.
The receiver is the instance of the superclass object.
Defines the clang::ASTContext interface.
SVal attemptDownCast(SVal Base, QualType DerivedPtrType, bool &Failed)
Attempts to do a down cast.
SVal getSelfSVal() const
Return the value of 'self' if available.
const VarRegion * getParameterLocation(unsigned Index) const
Returns memory location for a parameter variable within the callee stack frame.
SVal getReceiverSVal() const
Returns the value of the receiver at the time of this call.
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Represents a function declaration or definition.
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Smart pointer class that efficiently represents Objective-C method names.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
MemRegion - The root abstract class for all memory regions.
bool isBlockPointerType() const
bool argumentsMayEscape() const override
Returns true if any of the arguments are known to escape to long- term storage, even if this method w...
Selector getSelector() const
ObjCInterfaceDecl * getClassInterface()
Stmt * getBody() const
Get the body of the Declaration.
CFGStmtMap * getCFGStmtMap()
static const Expr * getSyntacticFromForPseudoObjectExpr(const PseudoObjectExpr *POE)
Stmt - This represents one statement.
Information about invalidation for a particular region/symbol.
ProgramPoint getProgramPoint(bool IsPreVisit=false, const ProgramPointTag *Tag=nullptr) const
Returns an appropriate ProgramPoint for this call.
FunctionType - C99 6.7.5.3 - Function Declarators.
static bool isCallToSelfClass(const ObjCMessageExpr *ME)
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
C Language Family Type Representation.
Defines the SourceManager interface.
ObjCInterfaceDecl * getReceiverInterface() const
Retrieve the Objective-C interface to which this message is being directed, if known.
AnalysisDeclContext * getCalleeAnalysisDeclContext() const
Returns AnalysisDeclContext for the callee stack frame.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
Decl - This represents one declaration (or definition), e.g.
const RecordType * getAsStructureType() const
Represents C++ object destructor generated from a call to delete.
SourceRange getSourceRange() const override
Represents a program point just before an implicit call event.
A container of type source information.
CallEventRef getSimpleCall(const CallExpr *E, ProgramStateRef State, const LocationContext *LCtx)
virtual RuntimeDefinition getRuntimeDefinition() const =0
Returns the definition of the function or method that will be called.
SVal evalCast(SVal val, QualType castTy, QualType originalType)
void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const override
Expr * ignoreParenBaseCasts() LLVM_READONLY
Ignore parentheses and derived-to-base casts.
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
const Expr * getOriginExpr() const
Returns the expression whose value will be the result of this call.
Represents a variable declaration or definition.
const T * getAs() const
Member-template getAs<specific type>'.
loc::MemRegionVal getCXXThis(const CXXMethodDecl *D, const StackFrameContext *SFC)
Return a memory region for the 'this' object reference.
void setTrait(SymbolRef Sym, InvalidationKinds IK)
SVal getSVal(const Stmt *S) const
Get the value of arbitrary expressions at this point in the path.
ObjCMethodDecl - Represents an instance or class method declaration.
static bool isVoidPointerToNonConst(QualType T)
const Expr * getCXXThisExpr() const override
Returns the expression representing the implicit 'this' object.
ArrayRef< ParmVarDecl * > parameters() const override
Return call's formal parameters.
Represents a parameter to a function.
Defines the clang::Expr interface and subclasses for C++ expressions.
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Represents a struct/union/class.
bool isValid() const
Return false if no dynamic type info is available.
One of these records is kept for each identifier that is lexed.
RuntimeDefinition getRuntimeDefinition() const override
MemRegionManager & getRegionManager()
param_type_iterator param_type_end() const
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
field_range fields() const
AnalysisDeclContext contains the context data for the function or method under analysis.
StringRef getCTUDir()
Returns the directory containing the CTU related files.
Represents C++ object destructor implicitly generated for automatic object or temporary bound to cons...
bool isReferenceType() const
static bool isInCodeFile(SourceLocation SL, const SourceManager &SM)
virtual const Expr * getArgExpr(unsigned Index) const
Returns the expression associated with a given argument.
SValBuilder & getSValBuilder()
bool isObjCSelType() const
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
ArrayRef< ParmVarDecl * > parameters() const
static void addParameterValuesToBindings(const StackFrameContext *CalleeCtx, CallEvent::BindingsTy &Bindings, SValBuilder &SVB, const CallEvent &Call, ArrayRef< ParmVarDecl *> parameters)
BlockDataRegion - A region that represents a block instance.
Represents any expression that calls an Objective-C method.
virtual Kind getKind() const =0
Returns the kind of call this is.
const ImplicitParamDecl * getSelfDecl() const
bool hasNonZeroCallbackArg() const
Returns true if any of the arguments appear to represent callbacks.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
An x-value expression is a reference to an object with independent storage but which can be "moved"...
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
static void findPtrToConstParams(llvm::SmallSet< unsigned, 4 > &PreserveArgs, const CallEvent &Call)
const clang::PrintingPolicy & getPrintingPolicy() const
const LocationContext * getParent() const
static bool isPointerToConst(QualType Ty)
Returns true if a type is a pointer-to-const or reference-to-const with no further indirection...
QualType getType() const
Returns the currently inferred upper bound on the runtime type.
static const ObjCMethodDecl * findDefiningRedecl(const ObjCMethodDecl *MD)
SVal getReturnValue() const
Returns the return value of the call.
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
param_type_iterator param_type_begin() const
Returns an iterator over the types of the call's formal parameters.
Represents an ObjC class declaration.
static bool isVariadic(const Decl *D)
Returns true if the given decl is known to be variadic.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
virtual ArrayRef< ParmVarDecl * > parameters() const =0
Return call's formal parameters.
const CFGBlock * getCallSiteBlock() const
SymbolRef getAsSymbol(bool IncludeBaseRegions=false) const
If this SVal wraps a symbol return that SymbolRef.
SmallVectorImpl< FrameBindingTy > BindingsTy
const StackFrameContext * getStackFrame(AnalysisDeclContext *Ctx, LocationContext const *Parent, const Stmt *S, const CFGBlock *Blk, unsigned Idx)
const Expr * getCXXThisExpr() const override
Returns the expression representing the implicit 'this' object.
ObjCMessageKind
Represents the ways an Objective-C message send can occur.
bool isReceiverSelfOrSuper() const
Checks if the receiver refers to 'self' or 'super'.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
const Stmt * getCallSite() const
ArrayRef< ParmVarDecl * > parameters() const override
Represents a single basic block in a source-level CFG.
bool argumentsMayEscape() const override
Loc makeLoc(SymbolRef sym)
ArrayRef< ParmVarDecl * > parameters() const override
AnalysisDeclContext * getContext(const Decl *D)
const LocationContext * getLocationContext() const
The context in which the call is being evaluated.
static bool isCallback(QualType T)
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
bool canBeASubClass() const
Returns false if the type information is precise (the type T is the only type in the lattice)...
Expr - This represents one expression.
void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const override
Stores the currently inferred strictest bound on the runtime type of a region in a given state along ...
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
CFGBlock * getBlock(Stmt *S)
Returns the CFGBlock the specified Stmt* appears in.
CallEventRef getCaller(const StackFrameContext *CalleeCtx, ProgramStateRef State)
static bool isCLibraryFunction(const FunctionDecl *FD, StringRef Name=StringRef())
Returns true if the callee is an externally-visible function in the top-level namespace, such as malloc.
llvm::mapped_iterator< ArrayRef< ParmVarDecl * >::iterator, GetTypeFn > param_type_iterator
const Expr * getCallee() const
bool isInSystemHeader() const
Returns true if the callee is known to be from a system header.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
ObjCInterfaceDecl * getSuperClass() const
virtual SVal getCXXThisVal() const
Returns the value of the implicit 'this' object.
const IdentifierInfo * getCalleeIdentifier() const
Returns the name of the callee, if its name is a simple identifier.
void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const override
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
virtual const Decl * getDecl() const
Returns the declaration of the function or method that will be called.
An expression that sends a message to the given Objective-C object or class.
virtual cross_tu::CrossTranslationUnitContext * getCrossTranslationUnitContext()=0
QualType getRecordType(const RecordDecl *Decl) const
StoreManager & getStoreManager()
unsigned getNumArgs() const
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Represents C++ object destructor implicitly generated for base object in destructor.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
ParentMap & getParentMap() const
Optional< T > getAs() const
Convert to the specified SVal type, returning None if this SVal is not of the desired type...
virtual bool argumentsMayEscape() const
Returns true if any of the arguments are known to escape to long- term storage, even if this method w...
RuntimeDefinition getRuntimeDefinition() const override
bool isConstQualified() const
Determine whether this type is const-qualified.
virtual SourceRange getSourceRange() const
Returns a source range for the entire call, suitable for outputting in diagnostics.
void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const override
Populates the given SmallVector with the bindings in the callee's stack frame at the start of this ca...
const MemRegion * StripCasts(bool StripBaseCasts=true) const
const ImplicitParamDecl * getSelfDecl() const
Return the ImplicitParamDecl* associated with 'self' if this AnalysisDeclContext wraps an ObjCMethodD...
Defines the runtime definition of the called function.
QualType getCanonicalType() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
This class represents a description of a function call using the number of arguments and the name of ...
IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Encodes a location in the source.
const FunctionDecl * getDecl() const override
static bool isCallStmt(const Stmt *S)
Returns true if this is a statement is a function or method call of some kind.
ProgramPoints can be "tagged" as representing points specific to a given analysis entity...
const MemRegion * getAsRegion() const
Represents a static or instance method of a struct/union/class.
ASTContext & getContext()
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
const StackFrameContext * getStackFrame() const
const Decl * getDecl() const
bool isAnyPointerType() const
bool naiveCTUEnabled()
Returns true when naive cross translation unit analysis is enabled.
Represents one property declaration in an Objective-C interface.
AnalyzerOptions & options
RuntimeDefinition getRuntimeDefinition() const override
const ObjCMethodDecl * getMethodDecl() const
Tells that a region's contents is not changed.
virtual void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const
Used to specify non-argument regions that will be invalidated as a result of this call...
Optional< T > getAs() const
Convert to the specified CFGElement type, returning None if this CFGElement is not of the desired typ...
Defines various enumerations that describe declaration and type specifiers.
StringRef getName() const
Return the actual identifier string.
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
static const unsigned NoArgRequirement
llvm::Expected< const FunctionDecl * > getCrossTUDefinition(const FunctionDecl *FD, StringRef CrossTUDir, StringRef IndexName)
This function loads a function definition from an external AST file and merge it into the original AS...
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
SVal getCXXThisVal() const
Returns the value of the implicit 'this' object.
Dataflow Directional Tag Classes.
virtual bool canBeOverridenInSubclass(ObjCInterfaceDecl *IDecl, Selector Sel) const
Check if the selector may have multiple definitions (may have overrides).
const BlockDataRegion * getBlockRegion() const
Returns the region associated with this instance of the block.
AnalysisDeclContextManager * getManager() const
Return the AnalysisDeclContextManager (if any) that created this AnalysisDeclContext.
bool isValid() const
Return true if this is a valid SourceLocation object.
virtual SourceRange getArgSourceRange(unsigned Index) const
Returns the source range for errors associated with this argument.
Represents a program point just after an implicit call event.
DynamicTypeInfo getDynamicTypeInfo(ProgramStateRef State, const MemRegion *Reg)
Get dynamic type information for a region.
RuntimeDefinition getRuntimeDefinition() const override
const VarRegion * getVarRegion(const VarDecl *D, const LocationContext *LC)
getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and LocationC...
QualType getSuperType() const
Retrieve the type referred to by 'super'.
StmtClass getStmtClass() const
bool hasVoidPointerToNonConstArg() const
Returns true if any of the arguments is void*.
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
Represents an abstract call to a function or method along a particular path.
ObjCMessageKind getMessageKind() const
Returns how the message was written in the source (property access, subscript, or explicit message se...
This class is used for tools that requires cross translation unit capability.
const Decl * getDecl() const
Expr * IgnoreParenImpCasts() LLVM_READONLY
IgnoreParenImpCasts - Ignore parentheses and implicit casts.
Represents a pointer to an Objective C object.
const FunctionDecl * getAsFunctionDecl() const
getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a CodeTextRegion wrapping a FunctionDecl...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
StringRef getCTUIndexName()
Returns the name of the file containing the CTU index of functions.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
unsigned getIndex() const
bool hasBody() const override
Determine whether this method has a body.
static QualType getDeclaredResultType(const Decl *D)
Returns the result type of a function or method declaration.
const StackFrameContext * getStackFrame() const
bool isGlobalCFunction(StringRef SpecificName=StringRef()) const
Returns true if the callee is an externally-visible function in the top-level namespace, such as malloc.
ObjCMethodDecl * lookupMethod(Selector Sel, bool isInstance, bool shallowCategoryLookup=false, bool followSuper=true, const ObjCCategoryDecl *C=nullptr) const
lookupMethod - This method returns an instance/class method by looking in the class, its categories, and its super classes (using a linear search).
QualType getResultType() const
Returns the result type, adjusted for references.
bool hasMutableFields() const
Determine whether this class, or any of its class subobjects, contains a mutable field.
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
bool hasNonNullArgumentsWithType(bool(*Condition)(QualType)) const
Returns true if the type of any of the non-null arguments satisfies the condition.
const ProgramStateRef & getState() const
The state in which the call is being evaluated.
Defines the clang::SourceLocation class and associated facilities.
Represents a C++ struct/union/class.
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
SVal getCXXThisVal() const override
Returns the value of the implicit 'this' object.
Represents C++ object destructor implicitly generated by compiler on various occasions.
bool isCalled(const CallDescription &CD) const
Returns true if the CallEvent is a call to a function that matches the CallDescription.
ObjCIvarDecl - Represents an ObjC instance variable.
virtual unsigned getNumArgs() const =0
Returns the number of arguments (explicit and implicit).
Represents a top-level expression in a basic block.
llvm::PointerIntPair< const PseudoObjectExpr *, 2 > ObjCMessageDataTy
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
const MemRegion * getBaseRegion() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
void emitCrossTUDiagnostics(const IndexError &IE)
Emit diagnostics for the user for potential configuration errors.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
const ObjCPropertyDecl * getAccessedProperty() const
Stmt * getParentIgnoreParenCasts(Stmt *) const
ProgramStateRef invalidateRegions(unsigned BlockCount, ProgramStateRef Orig=nullptr) const
Returns a new state with all argument regions invalidated.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
A reference to a declared variable, function, enum, etc.
ArrayRef< ParmVarDecl * > parameters() const
bool isPointerType() const
virtual SVal getArgSVal(unsigned Index) const
Returns the value of a given argument at the time of the call.
An l-value expression is a reference to an object with independent storage.
A trivial tuple used to represent a source range.
bool isPropertyAccessor() const
AnalysisDeclContext * getAnalysisDeclContext() const
SourceLocation getEndOfDefinitionLoc() const
bool isFunctionPointerType() const
The receiver is a superclass.
bool isInstanceMessage() const
Determine whether this is an instance message to either a computed object or to super.
SourceLocation getBegin() const
Represents C++ object destructor implicitly generated at the end of full expression for temporary obj...
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
bool isUnknownOrUndef() const
SourceLocation getLocation() const
ArrayRef< ParmVarDecl * > parameters() const
void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const override
const StackFrameContext * getCalleeStackFrame() const
Returns the callee stack frame.
virtual AnalysisManager & getAnalysisManager()=0