diff options
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7e33bda..560181f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -292,13 +292,14 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const std::string const& only_filename = cmSystemTools::GetFilenameName(full_path); bool trace = trace_only_this_files.empty(); if (!trace) { - for (std::vector<std::string>::const_iterator i = - trace_only_this_files.begin(); - !trace && i != trace_only_this_files.end(); ++i) { - std::string::size_type const pos = full_path.rfind(*i); + for (std::string const& file : trace_only_this_files) { + std::string::size_type const pos = full_path.rfind(file); trace = (pos != std::string::npos) && - ((pos + i->size()) == full_path.size()) && - (only_filename == cmSystemTools::GetFilenameName(*i)); + ((pos + file.size()) == full_path.size()) && + (only_filename == cmSystemTools::GetFilenameName(file)); + if (trace) { + break; + } } // Do nothing if current file wasn't requested for trace... if (!trace) { @@ -347,6 +348,9 @@ public: this->Makefile->Backtrace = this->Makefile->Backtrace.Pop(); } + cmMakefileCall(const cmMakefileCall&) = delete; + cmMakefileCall& operator=(const cmMakefileCall&) = delete; + private: cmMakefile* Makefile; }; @@ -438,6 +442,9 @@ public: ~IncludeScope(); void Quiet() { this->ReportError = false; } + IncludeScope(const IncludeScope&) = delete; + IncludeScope& operator=(const IncludeScope&) = delete; + private: cmMakefile* Makefile; bool NoPolicyScope; @@ -605,6 +612,9 @@ public: void Quiet() { this->ReportError = false; } + ListFileScope(const ListFileScope&) = delete; + ListFileScope& operator=(const ListFileScope&) = delete; + private: cmMakefile* Makefile; bool ReportError; @@ -1496,6 +1506,9 @@ public: void Quiet() { this->ReportError = false; } + BuildsystemFileScope(const BuildsystemFileScope&) = delete; + BuildsystemFileScope& operator=(const BuildsystemFileScope&) = delete; + private: cmMakefile* Makefile; cmGlobalGenerator* GG; @@ -1848,10 +1861,8 @@ void cmMakefile::CheckForUnusedVariables() const if (!this->WarnUnused) { return; } - const std::vector<std::string>& unused = this->StateSnapshot.UnusedKeys(); - std::vector<std::string>::const_iterator it = unused.begin(); - for (; it != unused.end(); ++it) { - this->LogUnused("out of scope", *it); + for (const std::string& key : this->StateSnapshot.UnusedKeys()) { + this->LogUnused("out of scope", key); } } @@ -2195,7 +2206,7 @@ cmSourceGroup* cmMakefile::FindSourceGroup( } // Shouldn't get here, but just in case, return the default group. - return &groups.front(); + return groups.data(); } #endif @@ -2427,16 +2438,18 @@ bool cmMakefile::CanIWriteThisFile(std::string const& fileName) const cmSystemTools::SameFile(fileName, this->GetHomeOutputDirectory()); } -std::string cmMakefile::GetRequiredDefinition(const std::string& name) const +const std::string& cmMakefile::GetRequiredDefinition( + const std::string& name) const { - const char* ret = this->GetDefinition(name); - if (!ret) { + static std::string const empty; + const std::string* def = GetDef(name); + if (!def) { cmSystemTools::Error("Error required internal CMake variable not " "set, cmake may not be built correctly.\n", "Missing variable is:\n", name.c_str()); - return std::string(); + return empty; } - return std::string(ret); + return *def; } bool cmMakefile::IsDefinitionSet(const std::string& name) const @@ -3057,10 +3070,8 @@ bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff, // loop over all function blockers to see if any block this command // evaluate in reverse, this is critical for balanced IF statements etc - std::vector<cmFunctionBlocker*>::reverse_iterator pos; - for (pos = this->FunctionBlockers.rbegin(); - pos != this->FunctionBlockers.rend(); ++pos) { - if ((*pos)->IsFunctionBlocked(lff, *this, status)) { + for (cmFunctionBlocker* pos : cmReverseRange(this->FunctionBlockers)) { + if (pos->IsFunctionBlocked(lff, *this, status)) { return true; } } @@ -3548,7 +3559,7 @@ cmState* cmMakefile::GetState() const return this->GetCMakeInstance()->GetState(); } -void cmMakefile::DisplayStatus(const char* message, float s) const +void cmMakefile::DisplayStatus(const std::string& message, float s) const { cmake* cm = this->GetCMakeInstance(); if (cm->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) { |