cmMakefile: Convert recursion to loop.

This commit is contained in:
Stephen Kelly 2015-06-04 23:38:51 +02:00
parent e00e8713de
commit 84e1805666
1 changed files with 10 additions and 12 deletions

View File

@ -4770,21 +4770,19 @@ cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const
cmPolicies::PolicyStatus
cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const
{
// Is the policy set in our stack?
for(PolicyStackType::const_reverse_iterator psi = this->PolicyStack.rbegin();
psi != this->PolicyStack.rend(); ++psi)
cmLocalGenerator* lg = this->LocalGenerator;
while(lg)
{
cmMakefile const* mf = lg->GetMakefile();
for(PolicyStackType::const_reverse_iterator psi =
mf->PolicyStack.rbegin(); psi != mf->PolicyStack.rend(); ++psi)
{
if(psi->IsDefined(id))
{
return psi->Get(id);
}
}
// If we have a parent directory, recurse up to it.
if(this->LocalGenerator->GetParent())
{
cmMakefile* parent = this->LocalGenerator->GetParent()->GetMakefile();
return parent->GetPolicyStatusInternal(id);
lg = lg->GetParent();
}
// The policy is not set. Use the default for this CMake version.