[cfe-commits] r149660 - in /cfe/trunk: include/clang/Sema/ScopeInfo.h lib/Sema/SemaExprCXX.cpp

Eli Friedman eli.friedman at gmail.com
Thu Feb 2 17:39:10 PST 2012


Author: efriedma
Date: Thu Feb  2 19:39:09 2012
New Revision: 149660

URL: http://llvm.org/viewvc/llvm-project?rev=149660&view=rev
Log:
Note whether a lambda is mutable in the LambdaScopeInfo; this information will be necessary to handle references to captured variables.


Modified:
    cfe/trunk/include/clang/Sema/ScopeInfo.h
    cfe/trunk/lib/Sema/SemaExprCXX.cpp

Modified: cfe/trunk/include/clang/Sema/ScopeInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ScopeInfo.h?rev=149660&r1=149659&r2=149660&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/ScopeInfo.h (original)
+++ cfe/trunk/include/clang/Sema/ScopeInfo.h Thu Feb  2 19:39:09 2012
@@ -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;
   }

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=149660&r1=149659&r2=149660&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Feb  2 19:39:09 2012
@@ -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(), 





More information about the cfe-commits mailing list