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 2015ce7..5008999 100644
--- a/include/clang/Sema/ScopeInfo.h
+++ b/include/clang/Sema/ScopeInfo.h
@@ -276,9 +276,11 @@
   /// 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 6542629..1ff6f59 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -4946,6 +4946,8 @@
   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(),