cmMakefile: Create a unified raii for function scopes.

This commit is contained in:
Stephen Kelly
2015-05-31 18:19:58 +02:00
parent 91cd014d64
commit d5dc4169ac
3 changed files with 51 additions and 12 deletions

View File

@@ -73,7 +73,6 @@ public:
cmPolicies::PolicyMap Policies;
};
bool cmFunctionHelperCommand::InvokeInitialPass
(const std::vector<cmListFileArgument>& args,
cmExecutionStatus & inStatus)
@@ -93,14 +92,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass
return false;
}
// we push a scope on the makefile
cmMakefile::ScopePushPop varScope(this->Makefile);
cmMakefile::LexicalPushPop lexScope(this->Makefile);
static_cast<void>(varScope);
// Push a weak policy scope which restores the policies recorded at
// function creation.
cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies);
cmMakefile::FunctionPushPop functionScope(this->Makefile,
this->Policies);
// set the value of argc
std::ostringstream strStream;
@@ -145,8 +138,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass
{
// The error message should have already included the call stack
// so we do not need to report an error here.
lexScope.Quiet();
polScope.Quiet();
functionScope.Quiet();
inStatus.SetNestedError(true);
return false;
}