aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Sema/ScopeInfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Sema/ScopeInfo.h')
-rw-r--r--include/clang/Sema/ScopeInfo.h59
1 files changed, 38 insertions, 21 deletions
diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h
index 06afe1a8ae9d..63427aaa4a75 100644
--- a/include/clang/Sema/ScopeInfo.h
+++ b/include/clang/Sema/ScopeInfo.h
@@ -110,6 +110,21 @@ public:
/// with \c __attribute__((objc_requires_super)).
bool ObjCShouldCallSuper;
+ /// True when this is a method marked as a designated initializer.
+ bool ObjCIsDesignatedInit;
+ /// This starts true for a method marked as designated initializer and will
+ /// be set to false if there is an invocation to a designated initializer of
+ /// the super class.
+ bool ObjCWarnForNoDesignatedInitChain;
+
+ /// True when this is an initializer method not marked as a designated
+ /// initializer within a class that has at least one initializer marked as a
+ /// designated initializer.
+ bool ObjCIsSecondaryInit;
+ /// This starts true for a secondary initializer method and will be set to
+ /// false if there is an invocation of an initializer on 'self'.
+ bool ObjCWarnForNoInitDelegation;
+
/// \brief Used to determine if errors occurred in this function or block.
DiagnosticErrorTrap ErrorTrap;
@@ -318,6 +333,10 @@ public:
HasIndirectGoto(false),
HasDroppedStmt(false),
ObjCShouldCallSuper(false),
+ ObjCIsDesignatedInit(false),
+ ObjCWarnForNoDesignatedInitChain(false),
+ ObjCIsSecondaryInit(false),
+ ObjCWarnForNoInitDelegation(false),
ErrorTrap(Diag) { }
virtual ~FunctionScopeInfo();
@@ -386,7 +405,7 @@ public:
enum IsThisCapture { ThisCapture };
Capture(IsThisCapture, bool IsNested, SourceLocation Loc,
QualType CaptureType, Expr *Cpy)
- : VarAndNested(0, IsNested),
+ : VarAndNested(nullptr, IsNested),
InitExprAndCaptureKind(Cpy, Cap_This),
Loc(Loc), EllipsisLoc(), CaptureType(CaptureType) {}
@@ -644,10 +663,10 @@ public:
SourceLocation PotentialThisCaptureLocation;
LambdaScopeInfo(DiagnosticsEngine &Diag)
- : CapturingScopeInfo(Diag, ImpCap_None), Lambda(0),
- CallOperator(0), NumExplicitCaptures(0), Mutable(false),
+ : CapturingScopeInfo(Diag, ImpCap_None), Lambda(nullptr),
+ CallOperator(nullptr), NumExplicitCaptures(0), Mutable(false),
ExprNeedsCleanups(false), ContainsUnexpandedParameterPack(false),
- AutoTemplateParameterDepth(0), GLTemplateParameterList(0)
+ AutoTemplateParameterDepth(0), GLTemplateParameterList(nullptr)
{
Kind = SK_Lambda;
}
@@ -708,10 +727,10 @@ public:
/// act of analyzing the enclosing full expression (ActOnFinishFullExpr)
/// if we can determine that the full expression is not instantiation-
/// dependent, then we can entirely avoid its capture.
- ///
- /// const int n = 0;
- /// [&] (auto x) {
- /// (void)+n + x;
+ ///
+ /// const int n = 0;
+ /// [&] (auto x) {
+ /// (void)+n + x;
/// };
/// Interestingly, this strategy would involve a capture of n, even though
/// it's obviously not odr-used here, because the full-expression is
@@ -725,12 +744,12 @@ public:
/// Before anyone is tempted to implement a strategy for not-capturing 'n',
/// consider the insightful warning in:
/// /cfe-commits/Week-of-Mon-20131104/092596.html
- /// "The problem is that the set of captures for a lambda is part of the ABI
- /// (since lambda layout can be made visible through inline functions and the
- /// like), and there are no guarantees as to which cases we'll manage to build
- /// an lvalue-to-rvalue conversion in, when parsing a template -- some
- /// seemingly harmless change elsewhere in Sema could cause us to start or stop
- /// building such a node. So we need a rule that anyone can implement and get
+ /// "The problem is that the set of captures for a lambda is part of the ABI
+ /// (since lambda layout can be made visible through inline functions and the
+ /// like), and there are no guarantees as to which cases we'll manage to build
+ /// an lvalue-to-rvalue conversion in, when parsing a template -- some
+ /// seemingly harmless change elsewhere in Sema could cause us to start or stop
+ /// building such a node. So we need a rule that anyone can implement and get
/// exactly the same result".
///
void markVariableExprAsNonODRUsed(Expr *CapturingVarExpr) {
@@ -738,7 +757,7 @@ public:
|| isa<MemberExpr>(CapturingVarExpr));
NonODRUsedCapturingExprs.insert(CapturingVarExpr);
}
- bool isVariableExprMarkedAsNonODRUsed(Expr *CapturingVarExpr) {
+ bool isVariableExprMarkedAsNonODRUsed(Expr *CapturingVarExpr) const {
assert(isa<DeclRefExpr>(CapturingVarExpr)
|| isa<MemberExpr>(CapturingVarExpr));
return NonODRUsedCapturingExprs.count(CapturingVarExpr);
@@ -761,16 +780,14 @@ public:
return getNumPotentialVariableCaptures() ||
PotentialThisCaptureLocation.isValid();
}
-
- // When passed the index, returns the VarDecl and Expr associated
+
+ // When passed the index, returns the VarDecl and Expr associated
// with the index.
- void getPotentialVariableCapture(unsigned Idx, VarDecl *&VD, Expr *&E);
-
+ void getPotentialVariableCapture(unsigned Idx, VarDecl *&VD, Expr *&E) const;
};
-
FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy()
- : Base(0, false), Property(0) {}
+ : Base(nullptr, false), Property(nullptr) {}
FunctionScopeInfo::WeakObjectProfileTy
FunctionScopeInfo::WeakObjectProfileTy::getSentinel() {