]> granicus.if.org Git - clang/commitdiff
Note whether a lambda is mutable in the LambdaScopeInfo; this information will be...
authorEli Friedman <eli.friedman@gmail.com>
Fri, 3 Feb 2012 01:39:09 +0000 (01:39 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 3 Feb 2012 01:39:09 +0000 (01:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149660 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/ScopeInfo.h
lib/Sema/SemaExprCXX.cpp

index 2015ce7fc44fedef70f2506d4e599071b320020a..5008999e7f5a284d237191321b49d2105e6c28f9 100644 (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;
   }
index 6542629d35e3679fe393bd18a6a67ddfd7075d4f..1ff6f59baeed69b6ecef2f3ae3fee6cba41e6371 100644 (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(),