forked from OSchip/llvm-project
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:
parent
172039a89c
commit
07f9df1953
|
@ -276,9 +276,11 @@ public:
|
||||||
/// explicit captures.
|
/// explicit captures.
|
||||||
unsigned NumExplicitCaptures;
|
unsigned NumExplicitCaptures;
|
||||||
|
|
||||||
|
bool Mutable;
|
||||||
|
|
||||||
LambdaScopeInfo(DiagnosticsEngine &Diag, CXXRecordDecl *Lambda)
|
LambdaScopeInfo(DiagnosticsEngine &Diag, CXXRecordDecl *Lambda)
|
||||||
: CapturingScopeInfo(Diag, ImpCap_None), Lambda(Lambda),
|
: CapturingScopeInfo(Diag, ImpCap_None), Lambda(Lambda),
|
||||||
NumExplicitCaptures(0)
|
NumExplicitCaptures(0), Mutable(false)
|
||||||
{
|
{
|
||||||
Kind = SK_Lambda;
|
Kind = SK_Lambda;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4946,6 +4946,8 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
|
||||||
else if (Intro.Default == LCD_ByRef)
|
else if (Intro.Default == LCD_ByRef)
|
||||||
LSI->ImpCaptureStyle = LambdaScopeInfo::ImpCap_LambdaByref;
|
LSI->ImpCaptureStyle = LambdaScopeInfo::ImpCap_LambdaByref;
|
||||||
|
|
||||||
|
LSI->Mutable = (Method->getTypeQualifiers() & Qualifiers::Const) == 0;
|
||||||
|
|
||||||
// Handle explicit captures.
|
// Handle explicit captures.
|
||||||
for (llvm::SmallVector<LambdaCapture, 4>::const_iterator
|
for (llvm::SmallVector<LambdaCapture, 4>::const_iterator
|
||||||
C = Intro.Captures.begin(),
|
C = Intro.Captures.begin(),
|
||||||
|
|
Loading…
Reference in New Issue