diff options
| author | Faisal Vali <faisalv@yahoo.com> | 2013-11-12 01:40:44 +0000 |
|---|---|---|
| committer | Faisal Vali <faisalv@yahoo.com> | 2013-11-12 01:40:44 +0000 |
| commit | 524ca28b2b6cd421dd609a132159d38e8e2f1263 (patch) | |
| tree | 03099b53b8995812ac4ec13d260395626ccd70f4 /clang | |
| parent | e9f36afe7dde402eccd05c3ee3e5c00653ddad24 (diff) | |
| download | bcm5719-llvm-524ca28b2b6cd421dd609a132159d38e8e2f1263.tar.gz bcm5719-llvm-524ca28b2b6cd421dd609a132159d38e8e2f1263.zip | |
REFACTOR: Have PushLambdaScope return the LambdaScopeInfo that it creates.
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.
llvm-svn: 194438
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/Sema/Sema.h | 2 | ||||
| -rw-r--r-- | clang/lib/Sema/Sema.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Sema/TreeTransform.h | 3 |
4 files changed, 8 insertions, 7 deletions
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 9de73c9ec00..19cef42436f 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -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 diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 41f72a68a38..6fe9fb58db1 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -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) { diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 0f6818cf5ae..9281951a814 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -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(); diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 52f647083a2..4b70e702b6b 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -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( |

