Author: faisalv
Date: Mon Nov 11 19:40:44 2013
New Revision: 194438
URL: http://llvm.org/viewvc/llvm-project?rev=194438&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=194438&r1=194437&r2=194438&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Mon Nov 11 19:40:44 2013
@@ -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
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=194438&r1=194437&r2=194438&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Mon Nov 11 19:40:44 2013
@@ -1029,8 +1029,10 @@ void Sema::PushBlockScope(Scope *BlockSc
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) {
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=194438&r1=194437&r2=194438&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Nov 11 19:40:44 2013
@@ -9434,8 +9434,8 @@ Sema::CheckForFunctionRedefinition(Funct
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();
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=194438&r1=194437&r2=194438&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Mon Nov 11 19:40:44 2013
@@ -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(
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits