diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8097dd1cb8..ebbe3e70e8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3347,7 +3347,7 @@ bool cmMakefile::IsLoopBlock() const return !this->LoopBlockCounter.empty() && this->LoopBlockCounter.top() > 0; } -std::string cmMakefile::GetExecutionFilePath() const +std::string const& cmMakefile::GetExecutionFilePath() const { assert(this->StateSnapshot.IsValid()); return this->StateSnapshot.GetExecutionListFile(); @@ -3357,8 +3357,8 @@ bool cmMakefile::ExpandArguments(std::vector const& inArgs, std::vector& outArgs, const char* filename) const { - std::string efp = this->GetExecutionFilePath(); if (!filename) { + auto const& efp = this->GetExecutionFilePath(); filename = efp.c_str(); } std::string value; @@ -3389,8 +3389,8 @@ bool cmMakefile::ExpandArguments( std::vector const& inArgs, std::vector& outArgs, const char* filename) const { - std::string efp = this->GetExecutionFilePath(); if (!filename) { + auto const& efp = this->GetExecutionFilePath(); filename = efp.c_str(); } std::string value; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7bcb0319f5..0a6e6e2c13 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -942,7 +942,7 @@ public: const char* GetDefineFlagsCMP0059() const; - std::string GetExecutionFilePath() const; + std::string const& GetExecutionFilePath() const; void EnforceDirectoryLevelRules() const; diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 3fcf61c09b..1e20abb257 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -53,7 +53,7 @@ void cmStateSnapshot::SetListFile(const std::string& listfile) *this->Position->ExecutionListFile = listfile; } -std::string cmStateSnapshot::GetExecutionListFile() const +std::string const& cmStateSnapshot::GetExecutionListFile() const { return *this->Position->ExecutionListFile; } diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h index 0ffd9728bf..d06cba37a8 100644 --- a/Source/cmStateSnapshot.h +++ b/Source/cmStateSnapshot.h @@ -32,7 +32,7 @@ public: void SetListFile(std::string const& listfile); - std::string GetExecutionListFile() const; + std::string const& GetExecutionListFile() const; std::vector GetChildren();