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.h47
1 files changed, 31 insertions, 16 deletions
diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h
index 15ee8a4ba7cd..d13667e80070 100644
--- a/include/clang/Sema/ScopeInfo.h
+++ b/include/clang/Sema/ScopeInfo.h
@@ -89,40 +89,43 @@ protected:
public:
/// \brief What kind of scope we are describing.
///
- ScopeKind Kind;
+ ScopeKind Kind : 3;
/// \brief Whether this function contains a VLA, \@try, try, C++
/// initializer, or anything else that can't be jumped past.
- bool HasBranchProtectedScope;
+ bool HasBranchProtectedScope : 1;
/// \brief Whether this function contains any switches or direct gotos.
- bool HasBranchIntoScope;
+ bool HasBranchIntoScope : 1;
/// \brief Whether this function contains any indirect gotos.
- bool HasIndirectGoto;
+ bool HasIndirectGoto : 1;
/// \brief Whether a statement was dropped because it was invalid.
- bool HasDroppedStmt;
+ bool HasDroppedStmt : 1;
/// A flag that is set when parsing a method that must call super's
/// implementation, such as \c -dealloc, \c -finalize, or any method marked
/// with \c __attribute__((objc_requires_super)).
- bool ObjCShouldCallSuper;
+ bool ObjCShouldCallSuper : 1;
/// True when this is a method marked as a designated initializer.
- bool ObjCIsDesignatedInit;
+ bool ObjCIsDesignatedInit : 1;
/// 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;
+ bool ObjCWarnForNoDesignatedInitChain : 1;
/// 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;
+ bool ObjCIsSecondaryInit : 1;
/// 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;
+ bool ObjCWarnForNoInitDelegation : 1;
+
+ /// First 'return' statement in the current function.
+ SourceLocation FirstReturnLoc;
/// First C++ 'try' statement in the current function.
SourceLocation FirstCXXTryLoc;
@@ -142,6 +145,14 @@ public:
/// optimization, or if we need to infer a return type.
SmallVector<ReturnStmt*, 4> Returns;
+ /// \brief The promise object for this coroutine, if any.
+ VarDecl *CoroutinePromise;
+
+ /// \brief The list of coroutine control flow constructs (co_await, co_yield,
+ /// co_return) that occur within the function or block. Empty if and only if
+ /// this function or block is not (yet known to be) a coroutine.
+ SmallVector<Stmt*, 4> CoroutineStmts;
+
/// \brief The stack of currently active compound stamement scopes in the
/// function.
SmallVector<CompoundScopeInfo, 4> CompoundScopes;
@@ -153,7 +164,7 @@ public:
/// \brief A list of parameters which have the nonnull attribute and are
/// modified in the function.
- llvm::SmallPtrSet<const ParmVarDecl*, 8> ModifiedNonNullParams;
+ llvm::SmallPtrSet<const ParmVarDecl*, 8> ModifiedNonNullParams;
public:
/// Represents a simple identification of a weak object.
@@ -291,6 +302,9 @@ private:
/// Part of the implementation of -Wrepeated-use-of-weak.
WeakObjectUseMap WeakObjectUses;
+protected:
+ FunctionScopeInfo(const FunctionScopeInfo&) = default;
+
public:
/// Record that a weak object was accessed.
///
@@ -364,6 +378,9 @@ public:
};
class CapturingScopeInfo : public FunctionScopeInfo {
+protected:
+ CapturingScopeInfo(const CapturingScopeInfo&) = default;
+
public:
enum ImplicitCaptureStyle {
ImpCap_None, ImpCap_LambdaByval, ImpCap_LambdaByref, ImpCap_Block,
@@ -549,7 +566,7 @@ public:
};
/// \brief Retains information about a block that is currently being parsed.
-class BlockScopeInfo : public CapturingScopeInfo {
+class BlockScopeInfo final : public CapturingScopeInfo {
public:
BlockDecl *TheDecl;
@@ -576,7 +593,7 @@ public:
};
/// \brief Retains information about a captured region.
-class CapturedRegionScopeInfo: public CapturingScopeInfo {
+class CapturedRegionScopeInfo final : public CapturingScopeInfo {
public:
/// \brief The CapturedDecl for this statement.
CapturedDecl *TheCapturedDecl;
@@ -617,7 +634,7 @@ public:
}
};
-class LambdaScopeInfo : public CapturingScopeInfo {
+class LambdaScopeInfo final : public CapturingScopeInfo {
public:
/// \brief The class that describes the lambda.
CXXRecordDecl *Lambda;
@@ -697,8 +714,6 @@ public:
Kind = SK_Lambda;
}
- ~LambdaScopeInfo() override;
-
/// \brief Note when all explicit captures have been added.
void finishedExplicitCaptures() {
NumExplicitCaptures = Captures.size();