diff options
Diffstat (limited to 'include/clang/Sema')
-rw-r--r-- | include/clang/Sema/ScopeInfo.h | 23 | ||||
-rw-r--r-- | include/clang/Sema/Sema.h | 2 |
2 files changed, 12 insertions, 13 deletions
diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h index 3b3bc5caf2..7ffc3bcfb9 100644 --- a/include/clang/Sema/ScopeInfo.h +++ b/include/clang/Sema/ScopeInfo.h @@ -166,7 +166,8 @@ public: }; CapturingScopeInfo(DiagnosticsEngine &Diag, ImplicitCaptureStyle Style) - : FunctionScopeInfo(Diag), ImpCaptureStyle(Style), CXXThisCaptureIndex(0) + : FunctionScopeInfo(Diag), ImpCaptureStyle(Style), CXXThisCaptureIndex(0), + HasImplicitReturnType(false) {} /// CaptureMap - A map of captured variables to (index+1) into Captures. @@ -179,6 +180,14 @@ public: /// Captures - The captures. SmallVector<Capture, 4> Captures; + /// \brief - Whether the target type of return statements in this context + /// is deduced (e.g. a lambda or block with omitted return type). + bool HasImplicitReturnType; + + /// ReturnType - The target type of return statements in this context, + /// or null if unknown. + QualType ReturnType; + void AddCapture(VarDecl *Var, bool isByref, bool isNested, Expr *Cpy) { Captures.push_back(Capture(Var, isByref, isNested, Cpy)); CaptureMap[Var] = Captures.size(); @@ -204,10 +213,6 @@ public: /// arguments etc. Scope *TheScope; - /// ReturnType - The return type of the block, or null if the block - /// signature didn't provide an explicit return type. - QualType ReturnType; - /// BlockType - The function type of the block, if one was given. /// Its return type may be BuiltinType::Dependent. QualType FunctionType; @@ -236,15 +241,9 @@ public: /// explicit captures. unsigned NumExplicitCaptures; - /// \brief - Whether the return type of the lambda is implicit - bool HasImplicitReturnType; - - /// ReturnType - The return type of the lambda, or null if unknown. - QualType ReturnType; - LambdaScopeInfo(DiagnosticsEngine &Diag, CXXRecordDecl *Lambda) : CapturingScopeInfo(Diag, ImpCap_None), Lambda(Lambda), - NumExplicitCaptures(0), HasImplicitReturnType(false) + NumExplicitCaptures(0) { Kind = SK_Lambda; } diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 12096f5fcb..97e09cfd01 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -2137,7 +2137,7 @@ public: bool AllowFunctionParameters); StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp); - StmtResult ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp); + StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp); StmtResult ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, |