mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-08 16:50:48 +00:00
block: Fix incorrect policy scope creation order
Creates the policy scope after the variable scope instead of the other way round. This ensures that the cmStateSnapshot which the policy is registered to is the same as the one created with the variable scope so that reading a policy from the parent snapshot does not incorrectly read policies from the new snapshot.
This commit is contained in:
@@ -40,19 +40,19 @@ public:
|
||||
BlockScopePushPop& operator=(BlockScopePushPop const&) = delete;
|
||||
|
||||
private:
|
||||
std::unique_ptr<cmMakefile::PolicyPushPop> PolicyScope;
|
||||
std::unique_ptr<cmMakefile::VariablePushPop> VariableScope;
|
||||
std::unique_ptr<cmMakefile::PolicyPushPop> PolicyScope;
|
||||
std::unique_ptr<cmMakefile::DiagnosticPushPop> DiagnosticScope;
|
||||
};
|
||||
|
||||
BlockScopePushPop::BlockScopePushPop(cmMakefile* mf, ScopeSet const& scopes)
|
||||
{
|
||||
if (scopes.contains(ScopeType::POLICIES)) {
|
||||
this->PolicyScope = cm::make_unique<cmMakefile::PolicyPushPop>(mf);
|
||||
}
|
||||
if (scopes.contains(ScopeType::VARIABLES)) {
|
||||
this->VariableScope = cm::make_unique<cmMakefile::VariablePushPop>(mf);
|
||||
}
|
||||
if (scopes.contains(ScopeType::POLICIES)) {
|
||||
this->PolicyScope = cm::make_unique<cmMakefile::PolicyPushPop>(mf);
|
||||
}
|
||||
if (scopes.contains(ScopeType::DIAGNOSTICS)) {
|
||||
this->DiagnosticScope = cm::make_unique<cmMakefile::DiagnosticPushPop>(mf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user