Note whether a lambda is mutable in the LambdaScopeInfo; this information will be necessary to handle references to captured variables.

llvm-svn: 149660
This commit is contained in:
Eli Friedman 2012-02-03 01:39:09 +00:00
parent 172039a89c
commit 07f9df1953
2 changed files with 5 additions and 1 deletions

View File

@ -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;
}

View File

@ -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<LambdaCapture, 4>::const_iterator
C = Intro.Captures.begin(),