23 using namespace clang;
46 WeakObjectUses.clear();
57 FunctionScopeInfo::WeakObjectProfileTy::BaseInfoTy
58 FunctionScopeInfo::WeakObjectProfileTy::getBaseInfo(
const Expr *
E) {
64 switch (E->getStmtClass()) {
65 case Stmt::DeclRefExprClass:
66 D = cast<DeclRefExpr>(
E)->getDecl();
67 IsExact = isa<VarDecl>(D);
69 case Stmt::MemberExprClass: {
75 case Stmt::ObjCIvarRefExprClass: {
81 case Stmt::PseudoObjectExprClass: {
88 const Expr *DoubleBase = BaseProp->getBase();
90 DoubleBase = OVE->getSourceExpr();
100 return BaseInfoTy(D, IsExact);
105 if (
auto *LSI = dyn_cast<LambdaScopeInfo>(
this))
107 else if (
auto CRSI = dyn_cast<CapturedRegionScopeInfo>(
this))
108 RD = CRSI->TheRecordDecl;
111 for (
auto *FD : RD->
fields()) {
112 if (FD->hasCapturedVLAType() && FD->getCapturedVLAType() == VAT)
118 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
125 Base = getBaseInfo(E);
133 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
const Expr *BaseE,
137 Base = getBaseInfo(BaseE);
141 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
144 assert(isa<VarDecl>(Property));
147 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
149 :
Base(getBaseInfo(IvarE->getBase())),
Property(IvarE->getDecl()) {
175 dyn_cast<BinaryConditionalOperator>(E)) {
184 if (!RefExpr->isObjectReceiver())
186 if (isa<OpaqueValueExpr>(RefExpr->getBase()))
195 else if (
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
198 Uses = WeakObjectUses.end();
210 if (Uses == WeakObjectUses.end())
214 FunctionScopeInfo::WeakUseVector::reverse_iterator ThisUse =
215 std::find(Uses->second.rbegin(), Uses->second.rend(),
WeakUseTy(E,
true));
216 if (ThisUse == Uses->second.rend())
224 assert(Idx < getNumPotentialVariableCaptures() &&
225 "Index of potential capture must be within 0 to less than the "
226 "number of captures!");
227 E = PotentiallyCapturingExprs[Idx];
229 VD = dyn_cast<
VarDecl>(DRE->getFoundDecl());
230 else if (
MemberExpr *ME = dyn_cast<MemberExpr>(E))
233 llvm_unreachable(
"Only DeclRefExprs or MemberExprs should be added for "
234 "potential captures");
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
const Expr * getBase() const
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
static const NamedDecl * getBestPropertyDecl(const ObjCPropertyRefExpr *PropE)
VarDecl - An instance of this class is created to represent a variable declaration or definition...
bool isExplicitProperty() const
SmallVector< SwitchStmt *, 8 > SwitchStack
SwitchStack - This is the current set of active switch statements in the block.
ObjCMethodDecl - Represents an instance or class method declaration.
Defines the clang::Expr interface and subclasses for C++ expressions.
bool HasDroppedStmt
Whether a statement was dropped because it was invalid.
RecordDecl - Represents a struct/union/class.
ObjCInterfaceDecl * getClassReceiver() const
~CapturedRegionScopeInfo() override
SourceLocation FirstSEHTryLoc
First SEH '__try' statement in the current function.
DiagnosticErrorTrap ErrorTrap
Used to determine if errors occurred in this function or block.
void getPotentialVariableCapture(unsigned Idx, VarDecl *&VD, Expr *&E) const
bool isSuperReceiver() const
field_range fields() const
Expr * IgnoreParenCasts() LLVM_READONLY
IgnoreParenCasts - Ignore parentheses and casts.
const Expr * getBase() const
SourceLocation FirstCXXTryLoc
First C++ 'try' statement in the current function.
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID)
Lookup a property by name in the specified DeclContext.
ConditionalOperator - The ?: ternary operator.
SmallVector< ReturnStmt *, 4 > Returns
The list of return statements that occur within the function or block, if there is any chance of appl...
virtual ~FunctionScopeInfo()
void recordUseOfWeak(const ExprT *E, bool IsRead=true)
Record that a weak object was accessed.
bool isObjCSelfExpr() const
Check if this expression is the ObjC 'self' implicit parameter.
Expr - This represents one expression.
ObjCMethodDecl * getImplicitPropertyGetter() const
bool HasBranchProtectedScope
Whether this function contains a VLA, @try, try, C++ initializer, or anything else that can't be jump...
bool isVLATypeCaptured(const VariableArrayType *VAT) const
Determine whether the given variable-array type has been captured.
An expression that sends a message to the given Objective-C object or class.
llvm::SmallPtrSet< const ParmVarDecl *, 8 > ModifiedNonNullParams
A list of parameters which have the nonnull attribute and are modified in the function.
VarDecl * CoroutinePromise
The promise object for this coroutine, if any.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Encodes a location in the source.
const TemplateArgument * iterator
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
SmallVector< Stmt *, 4 > CoroutineStmts
The list of coroutine control flow constructs (co_await, co_yield, co_return) that occur within the f...
bool ObjCWarnForNoDesignatedInitChain
This starts true for a method marked as designated initializer and will be set to false if there is a...
void reset()
Set to initial state of "no errors occurred".
Represents one property declaration in an Objective-C interface.
bool ObjCIsDesignatedInit
True when this is a method marked as a designated initializer.
bool ObjCShouldCallSuper
A flag that is set when parsing a method that must call super's implementation, such as -dealloc...
bool isObjectReceiver() const
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
bool ObjCIsSecondaryInit
True when this is an initializer method not marked as a designated initializer within a class that ha...
bool isClassReceiver() const
bool HasIndirectGoto
Whether this function contains any indirect gotos.
Represents a simple identification of a weak object.
bool ObjCWarnForNoInitDelegation
This starts true for a secondary initializer method and will be set to false if there is an invocatio...
detail::InMemoryDirectory::const_iterator E
Expr * IgnoreParenImpCasts() LLVM_READONLY
IgnoreParenImpCasts - Ignore parentheses and implicit casts.
SourceLocation FirstReturnLoc
First 'return' statement in the current function.
void markSafeWeakUse(const Expr *E)
Record that a given expression is a "safe" access of a weak object (e.g.
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver. ...
ObjCPropertyDecl * getExplicitProperty() const
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
SmallVector< PossiblyUnreachableDiag, 4 > PossiblyUnreachableDiags
A list of PartialDiagnostics created but delayed within the current function scope.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Represents a single use of a weak object.
A reference to a declared variable, function, enum, etc.
~BlockScopeInfo() override
NamedDecl - This represents a decl with a name.
Represents a C array with a specified size that is not an integer-constant-expression.
void Clear()
Clear out the information in this function scope, making it suitable for reuse.
bool HasBranchIntoScope
Whether this function contains any switches or direct gotos.