]> granicus.if.org Git - clang/commitdiff
REFACTOR: Have PushLambdaScope return the LambdaScopeInfo that it creates.
authorFaisal Vali <faisalv@yahoo.com>
Tue, 12 Nov 2013 01:40:44 +0000 (01:40 +0000)
committerFaisal Vali <faisalv@yahoo.com>
Tue, 12 Nov 2013 01:40:44 +0000 (01:40 +0000)
No Functionality change.

This refactoring avoids having to call getCurLambda right after PushLambdaScope, to obtain the LambdaScopeInfo that was created during the call to PushLambdaScope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194438 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/Sema.h
lib/Sema/Sema.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/TreeTransform.h

index 9de73c9ec00f927519e837c02914ab7eeaab9cd8..19cef42436f7fa2df04f2576da65e074497261d6 100644 (file)
@@ -960,7 +960,7 @@ public:
 
   void PushFunctionScope();
   void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
-  void PushLambdaScope();
+  sema::LambdaScopeInfo *PushLambdaScope();
   
   /// \brief This is used to inform Sema what the current TemplateParameterDepth
   /// is during Parsing.  Currently it is used to pass on the depth
index 41f72a68a38da72402a5f16ac50694e87d1c851e..6fe9fb58db17861e01cf1ea2379debbb59f866e8 100644 (file)
@@ -1029,8 +1029,10 @@ void Sema::PushBlockScope(Scope *BlockScope, BlockDecl *Block) {
                                               BlockScope, Block));
 }
 
-void Sema::PushLambdaScope() {
-  FunctionScopes.push_back(new LambdaScopeInfo(getDiagnostics()));
+LambdaScopeInfo* Sema::PushLambdaScope() {
+  LambdaScopeInfo *const LSI = new LambdaScopeInfo(getDiagnostics());
+  FunctionScopes.push_back(LSI);
+  return LSI;
 }
 
 void Sema::RecordParsingTemplateParameterDepth(unsigned Depth) {
index 0f6818cf5aec5ec4c259d3f2fbf1cf7731cd5869..9281951a814b2518bc50851adf31b1cd3e173f0f 100644 (file)
@@ -9434,8 +9434,8 @@ Sema::CheckForFunctionRedefinition(FunctionDecl *FD,
 static void RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator, 
                                    Sema &S) {
   CXXRecordDecl *const LambdaClass = CallOperator->getParent();
-  S.PushLambdaScope();
-  LambdaScopeInfo *LSI = S.getCurLambda();
+  
+  LambdaScopeInfo *LSI = S.PushLambdaScope();
   LSI->CallOperator = CallOperator;
   LSI->Lambda = LambdaClass;
   LSI->ReturnType = CallOperator->getResultType();
index 52f647083a24f3a66859436739f9e24667e0b953..4b70e702b6b20bea2307d4292da302f8480161d1 100644 (file)
@@ -8276,8 +8276,7 @@ template<typename Derived>
 ExprResult
 TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
  
-  getSema().PushLambdaScope();
-  LambdaScopeInfo *LSI = getSema().getCurLambda();
+  LambdaScopeInfo *LSI = getSema().PushLambdaScope();
   // Transform the template parameters, and add them to the current
   // instantiation scope. The null case is handled correctly.
   LSI->GLTemplateParameterList = getDerived().TransformTemplateParameterList(