From: Eli Friedman Date: Fri, 3 Feb 2012 01:39:09 +0000 (+0000) Subject: Note whether a lambda is mutable in the LambdaScopeInfo; this information will be... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d67d0cc40f31956b40b44b6ee3619d17a0f73294;p=clang Note whether a lambda is mutable in the LambdaScopeInfo; this information will be necessary to handle references to captured variables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149660 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h index 2015ce7fc4..5008999e7f 100644 --- a/include/clang/Sema/ScopeInfo.h +++ b/include/clang/Sema/ScopeInfo.h @@ -276,9 +276,11 @@ public: /// explicit captures. unsigned NumExplicitCaptures; + bool Mutable; + LambdaScopeInfo(DiagnosticsEngine &Diag, CXXRecordDecl *Lambda) : CapturingScopeInfo(Diag, ImpCap_None), Lambda(Lambda), - NumExplicitCaptures(0) + NumExplicitCaptures(0), Mutable(false) { Kind = SK_Lambda; } diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 6542629d35..1ff6f59bae 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -4946,6 +4946,8 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, else if (Intro.Default == LCD_ByRef) LSI->ImpCaptureStyle = LambdaScopeInfo::ImpCap_LambdaByref; + LSI->Mutable = (Method->getTypeQualifiers() & Qualifiers::Const) == 0; + // Handle explicit captures. for (llvm::SmallVector::const_iterator C = Intro.Captures.begin(),