diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Sema/ScopeInfo.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Sema/ScopeInfo.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/contrib/llvm/tools/clang/lib/Sema/ScopeInfo.cpp b/contrib/llvm/tools/clang/lib/Sema/ScopeInfo.cpp index 8b3493e..4d079e7 100644 --- a/contrib/llvm/tools/clang/lib/Sema/ScopeInfo.cpp +++ b/contrib/llvm/tools/clang/lib/Sema/ScopeInfo.cpp @@ -26,6 +26,12 @@ void FunctionScopeInfo::Clear() { HasBranchProtectedScope = false; HasBranchIntoScope = false; HasIndirectGoto = false; + HasDroppedStmt = false; + ObjCShouldCallSuper = false; + ObjCIsDesignatedInit = false; + ObjCWarnForNoDesignatedInitChain = false; + ObjCIsSecondaryInit = false; + ObjCWarnForNoInitDelegation = false; SwitchStack.clear(); Returns.clear(); @@ -45,7 +51,7 @@ FunctionScopeInfo::WeakObjectProfileTy::BaseInfoTy FunctionScopeInfo::WeakObjectProfileTy::getBaseInfo(const Expr *E) { E = E->IgnoreParenCasts(); - const NamedDecl *D = 0; + const NamedDecl *D = nullptr; bool IsExact = false; switch (E->getStmtClass()) { @@ -87,10 +93,9 @@ FunctionScopeInfo::WeakObjectProfileTy::getBaseInfo(const Expr *E) { return BaseInfoTy(D, IsExact); } - FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy( const ObjCPropertyRefExpr *PropE) - : Base(0, true), Property(getBestPropertyDecl(PropE)) { + : Base(nullptr, true), Property(getBestPropertyDecl(PropE)) { if (PropE->isObjectReceiver()) { const OpaqueValueExpr *OVE = cast<OpaqueValueExpr>(PropE->getBase()); @@ -105,7 +110,7 @@ FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy( FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(const Expr *BaseE, const ObjCPropertyDecl *Prop) - : Base(0, true), Property(Prop) { + : Base(nullptr, true), Property(Prop) { if (BaseE) Base = getBaseInfo(BaseE); // else, this is a message accessing a property on super. @@ -113,7 +118,7 @@ FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(const Expr *BaseE, FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy( const DeclRefExpr *DRE) - : Base(0, true), Property(DRE->getDecl()) { + : Base(nullptr, true), Property(DRE->getDecl()) { assert(isa<VarDecl>(Property)); } @@ -153,8 +158,14 @@ void FunctionScopeInfo::markSafeWeakUse(const Expr *E) { // Has this weak object been seen before? FunctionScopeInfo::WeakObjectUseMap::iterator Uses; - if (const ObjCPropertyRefExpr *RefExpr = dyn_cast<ObjCPropertyRefExpr>(E)) - Uses = WeakObjectUses.find(WeakObjectProfileTy(RefExpr)); + if (const ObjCPropertyRefExpr *RefExpr = dyn_cast<ObjCPropertyRefExpr>(E)) { + if (isa<OpaqueValueExpr>(RefExpr->getBase())) + Uses = WeakObjectUses.find(WeakObjectProfileTy(RefExpr)); + else { + markSafeWeakUse(RefExpr->getBase()); + return; + } + } else if (const ObjCIvarRefExpr *IvarE = dyn_cast<ObjCIvarRefExpr>(E)) Uses = WeakObjectUses.find(WeakObjectProfileTy(IvarE)); else if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) @@ -184,10 +195,11 @@ void FunctionScopeInfo::markSafeWeakUse(const Expr *E) { ThisUse->markSafe(); } -void LambdaScopeInfo::getPotentialVariableCapture(unsigned Idx, VarDecl *&VD, Expr *&E) { +void LambdaScopeInfo::getPotentialVariableCapture(unsigned Idx, VarDecl *&VD, + Expr *&E) const { assert(Idx < getNumPotentialVariableCaptures() && - "Index of potential capture must be within 0 to less than the " - "number of captures!"); + "Index of potential capture must be within 0 to less than the " + "number of captures!"); E = PotentiallyCapturingExprs[Idx]; if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) VD = dyn_cast<VarDecl>(DRE->getFoundDecl()); |