Skip to content

Commit

Permalink
REFACTOR: Have PushLambdaScope return the LambdaScopeInfo that it cre…
Browse files Browse the repository at this point in the history
…ates.

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
  • Loading branch information
faisalv committed Nov 12, 2013
1 parent 537b8a8 commit d78d659
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ class Sema {

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
Expand Down
6 changes: 4 additions & 2 deletions lib/Sema/Sema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions lib/Sema/TreeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit d78d659

Please sign in to comment.