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
This commit is contained in:
parent
e9f36afe7d
commit
524ca28b2b
|
@ -960,7 +960,7 @@ public:
|
||||||
|
|
||||||
void PushFunctionScope();
|
void PushFunctionScope();
|
||||||
void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
|
void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
|
||||||
void PushLambdaScope();
|
sema::LambdaScopeInfo *PushLambdaScope();
|
||||||
|
|
||||||
/// \brief This is used to inform Sema what the current TemplateParameterDepth
|
/// \brief This is used to inform Sema what the current TemplateParameterDepth
|
||||||
/// is during Parsing. Currently it is used to pass on the depth
|
/// is during Parsing. Currently it is used to pass on the depth
|
||||||
|
|
|
@ -1029,8 +1029,10 @@ void Sema::PushBlockScope(Scope *BlockScope, BlockDecl *Block) {
|
||||||
BlockScope, Block));
|
BlockScope, Block));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::PushLambdaScope() {
|
LambdaScopeInfo* Sema::PushLambdaScope() {
|
||||||
FunctionScopes.push_back(new LambdaScopeInfo(getDiagnostics()));
|
LambdaScopeInfo *const LSI = new LambdaScopeInfo(getDiagnostics());
|
||||||
|
FunctionScopes.push_back(LSI);
|
||||||
|
return LSI;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::RecordParsingTemplateParameterDepth(unsigned Depth) {
|
void Sema::RecordParsingTemplateParameterDepth(unsigned Depth) {
|
||||||
|
|
|
@ -9434,8 +9434,8 @@ Sema::CheckForFunctionRedefinition(FunctionDecl *FD,
|
||||||
static void RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator,
|
static void RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator,
|
||||||
Sema &S) {
|
Sema &S) {
|
||||||
CXXRecordDecl *const LambdaClass = CallOperator->getParent();
|
CXXRecordDecl *const LambdaClass = CallOperator->getParent();
|
||||||
S.PushLambdaScope();
|
|
||||||
LambdaScopeInfo *LSI = S.getCurLambda();
|
LambdaScopeInfo *LSI = S.PushLambdaScope();
|
||||||
LSI->CallOperator = CallOperator;
|
LSI->CallOperator = CallOperator;
|
||||||
LSI->Lambda = LambdaClass;
|
LSI->Lambda = LambdaClass;
|
||||||
LSI->ReturnType = CallOperator->getResultType();
|
LSI->ReturnType = CallOperator->getResultType();
|
||||||
|
|
|
@ -8276,8 +8276,7 @@ template<typename Derived>
|
||||||
ExprResult
|
ExprResult
|
||||||
TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
|
TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
|
||||||
|
|
||||||
getSema().PushLambdaScope();
|
LambdaScopeInfo *LSI = getSema().PushLambdaScope();
|
||||||
LambdaScopeInfo *LSI = getSema().getCurLambda();
|
|
||||||
// Transform the template parameters, and add them to the current
|
// Transform the template parameters, and add them to the current
|
||||||
// instantiation scope. The null case is handled correctly.
|
// instantiation scope. The null case is handled correctly.
|
||||||
LSI->GLTemplateParameterList = getDerived().TransformTemplateParameterList(
|
LSI->GLTemplateParameterList = getDerived().TransformTemplateParameterList(
|
||||||
|
|
Loading…
Reference in New Issue