cmState: Port dependent code to new cmStateSnapshot name

This commit is contained in:
Stephen Kelly 2016-10-18 21:28:48 +02:00
parent a9bf981a4c
commit cde6eb6249
18 changed files with 54 additions and 59 deletions

View File

@ -280,7 +280,7 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->AddCMakePaths();
this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot();
cmStateSnapshot snapshot = this->CMake->GetCurrentSnapshot();
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
snapshot.GetDirectory().SetCurrentSource(cwd);
snapshot.GetDirectory().SetCurrentBinary(cwd);

View File

@ -1062,7 +1062,7 @@ void cmGlobalGenerator::Configure()
this->FirstTimeProgress = 0.0f;
this->ClearGeneratorMembers();
cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
cmStateSnapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentSource(
this->CMakeInstance->GetHomeDirectory());
@ -1909,10 +1909,10 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen)
}
}
bool cmGlobalGenerator::IsExcluded(cmState::Snapshot const& rootSnp,
cmState::Snapshot const& snp_) const
bool cmGlobalGenerator::IsExcluded(cmStateSnapshot const& rootSnp,
cmStateSnapshot const& snp_) const
{
cmState::Snapshot snp = snp_;
cmStateSnapshot snp = snp_;
while (snp.IsValid()) {
if (snp == rootSnp) {
// No directory excludes itself.
@ -1933,8 +1933,8 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
{
assert(gen);
cmState::Snapshot rootSnp = root->GetStateSnapshot();
cmState::Snapshot snp = gen->GetStateSnapshot();
cmStateSnapshot rootSnp = root->GetStateSnapshot();
cmStateSnapshot snp = gen->GetStateSnapshot();
return this->IsExcluded(rootSnp, snp);
}
@ -1974,7 +1974,7 @@ void cmGlobalGenerator::FillProjectMap()
unsigned int i;
for (i = 0; i < this->LocalGenerators.size(); ++i) {
// for each local generator add all projects
cmState::Snapshot snp = this->LocalGenerators[i]->GetStateSnapshot();
cmStateSnapshot snp = this->LocalGenerators[i]->GetStateSnapshot();
std::string name;
do {
std::string snpProjName = snp.GetProjectName();

View File

@ -410,8 +410,8 @@ protected:
// has been populated.
void FillProjectMap();
void CheckTargetProperties();
bool IsExcluded(cmState::Snapshot const& root,
cmState::Snapshot const& snp) const;
bool IsExcluded(cmStateSnapshot const& root,
cmStateSnapshot const& snp) const;
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const;
virtual void InitializeProgressMarks() {}

View File

@ -1116,9 +1116,9 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
std::vector<cmState::Snapshot> const& children =
std::vector<cmStateSnapshot> const& children =
lg->GetStateSnapshot().GetChildren();
for (std::vector<cmState::Snapshot>::const_iterator stateIt =
for (std::vector<cmStateSnapshot>::const_iterator stateIt =
children.begin();
stateIt != children.end(); ++stateIt) {
targetsPerFolder[currentSourceFolder].push_back(
@ -1667,8 +1667,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
{
// Setup path conversions.
{
cmState::Snapshot snapshot =
this->GetCMakeInstance()->GetCurrentSnapshot();
cmStateSnapshot snapshot = this->GetCMakeInstance()->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentSource(dir_cur_src);
snapshot.GetDirectory().SetCurrentBinary(dir_cur_bld);
snapshot.GetDirectory().SetRelativePathTopSource(dir_top_src.c_str());

View File

@ -436,9 +436,8 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
std::vector<cmState::Snapshot> children =
lg->GetStateSnapshot().GetChildren();
for (std::vector<cmState::Snapshot>::const_iterator ci = children.begin();
std::vector<cmStateSnapshot> children = lg->GetStateSnapshot().GetChildren();
for (std::vector<cmStateSnapshot>::const_iterator ci = children.begin();
ci != children.end(); ++ci) {
std::string subdir = ci->GetDirectory().GetCurrentBinary();
subdir += "/";
@ -507,7 +506,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
if (!this->Makefiles.empty()) {
mf = this->Makefiles[0];
} else {
cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
cmStateSnapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentSource(
this->CMakeInstance->GetHomeDirectory());
snapshot.GetDirectory().SetCurrentBinary(
@ -817,8 +816,8 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
continue;
}
cmState::Snapshot csnp = lg->GetStateSnapshot();
cmState::Snapshot tsnp = tlg->GetStateSnapshot();
cmStateSnapshot csnp = lg->GetStateSnapshot();
cmStateSnapshot tsnp = tlg->GetStateSnapshot();
// Consider the directory containing the target and all its
// parents until something excludes the target.

View File

@ -248,8 +248,8 @@ private:
const char* GetBuildIgnoreErrorsFlag() const CM_OVERRIDE { return "-i"; }
std::string GetEditCacheCommand() const CM_OVERRIDE;
std::map<cmState::Snapshot, std::set<cmGeneratorTarget const*>,
cmState::Snapshot::StrictWeakOrder>
std::map<cmStateSnapshot, std::set<cmGeneratorTarget const*>,
cmStateSnapshot::StrictWeakOrder>
DirectoryTargetsMap;
void InitializeProgressMarks() CM_OVERRIDE;
};

View File

@ -298,7 +298,7 @@ struct cmListFileBacktrace::Entry : public cmListFileContext
unsigned int RefCount;
};
cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* up,
cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot bottom, Entry* up,
cmListFileContext const& lfc)
: Bottom(bottom)
, Cur(new Entry(lfc, up))
@ -307,7 +307,7 @@ cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* up,
this->Cur->Ref();
}
cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* cur)
cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot bottom, Entry* cur)
: Bottom(bottom)
, Cur(cur)
{
@ -323,7 +323,7 @@ cmListFileBacktrace::cmListFileBacktrace()
{
}
cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot snapshot)
cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot snapshot)
: Bottom(snapshot.GetCallStackBottom())
, Cur(CM_NULLPTR)
{

View File

@ -113,14 +113,14 @@ public:
// Construct an empty backtrace whose bottom sits in the directory
// indicated by the given valid snapshot.
cmListFileBacktrace(cmState::Snapshot snapshot);
cmListFileBacktrace(cmStateSnapshot snapshot);
// Backtraces may be copied and assigned as values.
cmListFileBacktrace(cmListFileBacktrace const& r);
cmListFileBacktrace& operator=(cmListFileBacktrace const& r);
~cmListFileBacktrace();
cmState::Snapshot GetBottom() const { return this->Bottom; }
cmStateSnapshot GetBottom() const { return this->Bottom; }
// Get a backtrace with the given file scope added to the top.
// May not be called until after construction with a valid snapshot.
@ -147,11 +147,11 @@ public:
private:
struct Entry;
cmState::Snapshot Bottom;
cmStateSnapshot Bottom;
Entry* Cur;
cmListFileBacktrace(cmState::Snapshot bottom, Entry* up,
cmListFileBacktrace(cmStateSnapshot bottom, Entry* up,
cmListFileContext const& lfc);
cmListFileBacktrace(cmState::Snapshot bottom, Entry* cur);
cmListFileBacktrace(cmStateSnapshot bottom, Entry* cur);
};
struct cmListFile

View File

@ -249,7 +249,7 @@ void cmLocalGenerator::GenerateTestFiles()
(*gi)->Compute(this);
(*gi)->Generate(fout, config, configurationTypes);
}
typedef std::vector<cmState::Snapshot> vec_t;
typedef std::vector<cmStateSnapshot> vec_t;
vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren();
std::string parentBinDir = this->GetCurrentBinaryDirectory();
for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) {
@ -446,12 +446,12 @@ void cmLocalGenerator::GenerateInstallRules()
this->GenerateTargetInstallRules(fout, config, configurationTypes);
// Include install scripts from subdirectories.
std::vector<cmState::Snapshot> children =
std::vector<cmStateSnapshot> children =
this->Makefile->GetStateSnapshot().GetChildren();
if (!children.empty()) {
fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
fout << " # Include the install script for each subdirectory.\n";
for (std::vector<cmState::Snapshot>::const_iterator ci = children.begin();
for (std::vector<cmStateSnapshot>::const_iterator ci = children.begin();
ci != children.end(); ++ci) {
if (!ci->GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
std::string odir = ci->GetDirectory().GetCurrentBinary();
@ -563,7 +563,7 @@ cmState* cmLocalGenerator::GetState() const
return this->GlobalGenerator->GetCMakeInstance()->GetState();
}
cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const
cmStateSnapshot cmLocalGenerator::GetStateSnapshot() const
{
return this->Makefile->GetStateSnapshot();
}
@ -1868,7 +1868,7 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
featureName += "_";
featureName += cmSystemTools::UpperCase(config);
}
cmState::Snapshot snp = this->StateSnapshot;
cmStateSnapshot snp = this->StateSnapshot;
while (snp.IsValid()) {
if (const char* value = snp.GetDirectory().GetProperty(featureName)) {
return value;

View File

@ -92,7 +92,7 @@ public:
cmGeneratorTarget& tgt) const;
cmState* GetState() const;
cmState::Snapshot GetStateSnapshot() const;
cmStateSnapshot GetStateSnapshot() const;
void AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
@ -337,7 +337,7 @@ protected:
virtual bool CheckDefinition(std::string const& define) const;
cmMakefile* Makefile;
cmState::Snapshot StateSnapshot;
cmStateSnapshot StateSnapshot;
cmListFileBacktrace DirectoryBacktrace;
cmGlobalGenerator* GlobalGenerator;
std::map<std::string, std::string> UniqueObjectNamesMap;

View File

@ -45,7 +45,7 @@ class cmMessenger;
// default is not to be building executables
cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
cmState::Snapshot const& snapshot)
cmStateSnapshot const& snapshot)
: GlobalGenerator(globalGenerator)
, StateSnapshot(snapshot)
, Backtrace(snapshot)
@ -1356,7 +1356,7 @@ private:
cmMakefile* Makefile;
cmGlobalGenerator* GG;
cmMakefile* CurrentMakefile;
cmState::Snapshot Snapshot;
cmStateSnapshot Snapshot;
bool ReportError;
};
@ -1538,7 +1538,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
return;
}
cmState::Snapshot newSnapshot =
cmStateSnapshot newSnapshot =
this->GetState()->CreateBuildsystemDirectorySnapshot(this->StateSnapshot);
newSnapshot.GetDirectory().SetCurrentSource(srcPath);
@ -3621,7 +3621,7 @@ void cmMakefile::AddCMakeDependFilesFromUser()
std::string cmMakefile::FormatListFileStack() const
{
std::vector<std::string> listFiles;
cmState::Snapshot snp = this->StateSnapshot;
cmStateSnapshot snp = this->StateSnapshot;
while (snp.IsValid()) {
listFiles.push_back(snp.GetExecutionListFile());
snp = snp.GetCallStackParent();
@ -3918,7 +3918,7 @@ void cmMakefile::StoreMatches(cmsys::RegularExpression& re)
this->MarkVariableAsUsed(nMatchesVariable);
}
cmState::Snapshot cmMakefile::GetStateSnapshot() const
cmStateSnapshot cmMakefile::GetStateSnapshot() const
{
return this->StateSnapshot;
}
@ -3999,7 +3999,7 @@ void cmMakefile::PopPolicy()
void cmMakefile::PopSnapshot(bool reportError)
{
// cmState::Snapshot manages nested policy scopes within it.
// cmStateSnapshot manages nested policy scopes within it.
// Since the scope corresponding to the snapshot is closing,
// reject any still-open nested policy scopes with an error.
while (!this->StateSnapshot.CanPopPolicyScope()) {

View File

@ -70,7 +70,7 @@ public:
* Construct an empty makefile.
*/
cmMakefile(cmGlobalGenerator* globalGenerator,
const cmState::Snapshot& snapshot);
const cmStateSnapshot& snapshot);
/**
* Destructor.
@ -753,7 +753,7 @@ public:
void ClearMatches();
void StoreMatches(cmsys::RegularExpression& re);
cmState::Snapshot GetStateSnapshot() const;
cmStateSnapshot GetStateSnapshot() const;
const char* GetDefineFlagsCMP0059() const;
@ -829,7 +829,7 @@ private:
cmMakefile(const cmMakefile& mf);
cmMakefile& operator=(const cmMakefile& mf);
cmState::Snapshot StateSnapshot;
cmStateSnapshot StateSnapshot;
cmListFileBacktrace Backtrace;
void ReadListFile(cmListFile const& listFile,

View File

@ -11,7 +11,7 @@
#include <set>
#include <sstream>
cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot)
cmOutputConverter::cmOutputConverter(cmStateSnapshot snapshot)
: StateSnapshot(snapshot)
, LinkScriptShell(false)
{

View File

@ -13,7 +13,7 @@
class cmOutputConverter
{
public:
cmOutputConverter(cmState::Snapshot snapshot);
cmOutputConverter(cmStateSnapshot snapshot);
enum OutputFormat
{
@ -125,7 +125,7 @@ private:
static std::string Shell__GetArgument(const char* in, int flags);
private:
cmState::Snapshot StateSnapshot;
cmStateSnapshot StateSnapshot;
bool LinkScriptShell;
};

View File

@ -165,7 +165,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
cmStateSnapshot snapshot = cm.GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(targetDirectory);
snapshot.GetDirectory().SetCurrentSource(targetDirectory);

View File

@ -481,7 +481,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
std::string homeOutputDir = this->GetHomeOutputDirectory();
this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
cmState::Snapshot snapshot = this->GetCurrentSnapshot();
cmStateSnapshot snapshot = this->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(
cmSystemTools::GetCurrentWorkingDirectory());
snapshot.GetDirectory().SetCurrentSource(
@ -517,7 +517,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
cmGlobalGenerator* gg = new cmGlobalGenerator(this);
this->SetGlobalGenerator(gg);
cmState::Snapshot snapshot = this->GetCurrentSnapshot();
cmStateSnapshot snapshot = this->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(
cmSystemTools::GetCurrentWorkingDirectory());
snapshot.GetDirectory().SetCurrentSource(

View File

@ -407,14 +407,11 @@ public:
void WatchUnusedCli(const std::string& var);
cmState* GetState() const { return this->State; }
void SetCurrentSnapshot(cmState::Snapshot snapshot)
void SetCurrentSnapshot(cmStateSnapshot snapshot)
{
this->CurrentSnapshot = snapshot;
}
cmState::Snapshot GetCurrentSnapshot() const
{
return this->CurrentSnapshot;
}
cmStateSnapshot GetCurrentSnapshot() const { return this->CurrentSnapshot; }
protected:
void RunCheckForUnusedVariables();
@ -490,7 +487,7 @@ private:
InstalledFilesMap InstalledFiles;
cmState* State;
cmState::Snapshot CurrentSnapshot;
cmStateSnapshot CurrentSnapshot;
cmMessenger* Messenger;
std::vector<std::string> TraceOnlyThisSources;

View File

@ -760,7 +760,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cm.GetCurrentSnapshot().SetDefaultDefinitions();
if (cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) {
cm.SetGlobalGenerator(ggd);
cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
cmStateSnapshot snapshot = cm.GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(startOutDir);
snapshot.GetDirectory().SetCurrentSource(startDir);
CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(ggd, snapshot));