23 using namespace clang;
43 WeakObjectUses.clear();
54 FunctionScopeInfo::WeakObjectProfileTy::BaseInfoTy
55 FunctionScopeInfo::WeakObjectProfileTy::getBaseInfo(
const Expr *E) {
61 switch (E->getStmtClass()) {
62 case Stmt::DeclRefExprClass:
63 D = cast<DeclRefExpr>(E)->getDecl();
64 IsExact = isa<VarDecl>(D);
66 case Stmt::MemberExprClass: {
72 case Stmt::ObjCIvarRefExprClass: {
78 case Stmt::PseudoObjectExprClass: {
85 const Expr *DoubleBase = BaseProp->getBase();
87 DoubleBase = OVE->getSourceExpr();
97 return BaseInfoTy(D, IsExact);
102 if (
auto *LSI = dyn_cast<LambdaScopeInfo>(
this))
104 else if (
auto CRSI = dyn_cast<CapturedRegionScopeInfo>(
this))
105 RD = CRSI->TheRecordDecl;
108 for (
auto *FD : RD->
fields()) {
109 if (FD->hasCapturedVLAType() && FD->getCapturedVLAType() == VAT)
115 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
122 Base = getBaseInfo(E);
130 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
const Expr *BaseE,
134 Base = getBaseInfo(BaseE);
138 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
141 assert(isa<VarDecl>(Property));
144 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
146 :
Base(getBaseInfo(IvarE->getBase())),
Property(IvarE->getDecl()) {
172 dyn_cast<BinaryConditionalOperator>(E)) {
179 FunctionScopeInfo::WeakObjectUseMap::iterator Uses;
181 if (!RefExpr->isObjectReceiver())
183 if (isa<OpaqueValueExpr>(RefExpr->getBase()))
192 else if (
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
195 Uses = WeakObjectUses.end();
207 if (Uses == WeakObjectUses.end())
211 FunctionScopeInfo::WeakUseVector::reverse_iterator ThisUse =
212 std::find(Uses->second.rbegin(), Uses->second.rend(),
WeakUseTy(E,
true));
213 if (ThisUse == Uses->second.rend())
221 assert(Idx < getNumPotentialVariableCaptures() &&
222 "Index of potential capture must be within 0 to less than the "
223 "number of captures!");
224 E = PotentiallyCapturingExprs[Idx];
226 VD = dyn_cast<
VarDecl>(DRE->getFoundDecl());
227 else if (
MemberExpr *ME = dyn_cast<MemberExpr>(E))
230 llvm_unreachable(
"Only DeclRefExprs or MemberExprs should be added for "
231 "potential captures");
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
const Expr * getBase() const
Expr * getSyntacticForm()
~LambdaScopeInfo() override
static const NamedDecl * getBestPropertyDecl(const ObjCPropertyRefExpr *PropE)
bool isExplicitProperty() const
SmallVector< SwitchStmt *, 8 > SwitchStack
Defines the clang::Expr interface and subclasses for C++ expressions.
bool HasDroppedStmt
Whether a statement was dropped because it was invalid.
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
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.
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)
bool isObjCSelfExpr() const
Check if this expression is the ObjC 'self' implicit parameter.
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.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
Expr * getSourceExpr() const
bool ObjCWarnForNoDesignatedInitChain
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 isObjectReceiver() const
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
bool isClassReceiver() const
bool HasIndirectGoto
Whether this function contains any indirect gotos.
bool ObjCWarnForNoInitDelegation
Expr * IgnoreParenImpCasts() LLVM_READONLY
void markSafeWeakUse(const Expr *E)
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).
SmallVector< PossiblyUnreachableDiag, 4 > PossiblyUnreachableDiags
A list of PartialDiagnostics created but delayed within the current function scope. These diagnostics are vetted for reachability prior to being emitted.
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
~BlockScopeInfo() override
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.