diff options
author | Craig Scott <craig.scott@crascit.com> | 2018-08-13 21:12:28 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-08-13 21:12:37 (GMT) |
commit | 0eb4b0bb7b2f7a82b3645907a5c02e57653afa8e (patch) | |
tree | 988efa12c4160ee7a76a6038322918f578e8231a | |
parent | cd8b094d1dacbff2fa5e520ca167d6f1880310f9 (diff) | |
parent | ada121e573fb1a4c2d4ea5ee2ee51daca80d4de8 (diff) | |
download | CMake-0eb4b0bb7b2f7a82b3645907a5c02e57653afa8e.zip CMake-0eb4b0bb7b2f7a82b3645907a5c02e57653afa8e.tar.gz CMake-0eb4b0bb7b2f7a82b3645907a5c02e57653afa8e.tar.bz2 |
Merge topic 'state-directory-stdstring'
ada121e573 cmStateDirectory: use const std::string& for return values
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2277
-rw-r--r-- | Source/cmLocalGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 4 | ||||
-rw-r--r-- | Source/cmOutputConverter.cxx | 4 | ||||
-rw-r--r-- | Source/cmStateDirectory.cxx | 18 | ||||
-rw-r--r-- | Source/cmStateDirectory.h | 8 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 6 |
6 files changed, 23 insertions, 21 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d265cab..5e6ce1a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2524,12 +2524,12 @@ std::string const& cmLocalGenerator::GetBinaryDirectory() const const char* cmLocalGenerator::GetCurrentBinaryDirectory() const { - return this->StateSnapshot.GetDirectory().GetCurrentBinary(); + return this->StateSnapshot.GetDirectory().GetCurrentBinary().c_str(); } const char* cmLocalGenerator::GetCurrentSourceDirectory() const { - return this->StateSnapshot.GetDirectory().GetCurrentSource(); + return this->StateSnapshot.GetDirectory().GetCurrentSource().c_str(); } std::string cmLocalGenerator::GetTargetDirectory( diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c868159..9e14917 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1637,12 +1637,12 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, const char* cmMakefile::GetCurrentSourceDirectory() const { - return this->StateSnapshot.GetDirectory().GetCurrentSource(); + return this->StateSnapshot.GetDirectory().GetCurrentSource().c_str(); } const char* cmMakefile::GetCurrentBinaryDirectory() const { - return this->StateSnapshot.GetDirectory().GetCurrentBinary(); + return this->StateSnapshot.GetDirectory().GetCurrentBinary().c_str(); } std::vector<cmTarget*> cmMakefile::GetImportedTargets() const diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index fd42c53..dbe6fa1 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -83,9 +83,9 @@ bool cmOutputConverter::ContainedInDirectory(std::string const& local_path, std::string const& remote_path, cmStateDirectory const& directory) { - const std::string relativePathTopBinary = + const std::string& relativePathTopBinary = directory.GetRelativePathTopBinary(); - const std::string relativePathTopSource = + const std::string& relativePathTopSource = directory.GetRelativePathTopSource(); const bool bothInBinary = diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index 6eac8e2..925b161 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -84,9 +84,9 @@ void cmStateDirectory::ComputeRelativePathTopBinary() } } -const char* cmStateDirectory::GetCurrentSource() const +std::string const& cmStateDirectory::GetCurrentSource() const { - return this->DirectoryState->Location.c_str(); + return this->DirectoryState->Location; } void cmStateDirectory::SetCurrentSource(std::string const& dir) @@ -101,9 +101,9 @@ void cmStateDirectory::SetCurrentSource(std::string const& dir) this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc); } -const char* cmStateDirectory::GetCurrentBinary() const +std::string const& cmStateDirectory::GetCurrentBinary() const { - return this->DirectoryState->OutputLocation.c_str(); + return this->DirectoryState->OutputLocation; } void cmStateDirectory::SetCurrentBinary(std::string const& dir) @@ -118,14 +118,14 @@ void cmStateDirectory::SetCurrentBinary(std::string const& dir) this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc); } -const char* cmStateDirectory::GetRelativePathTopSource() const +std::string const& cmStateDirectory::GetRelativePathTopSource() const { - return this->DirectoryState->RelativePathTopSource.c_str(); + return this->DirectoryState->RelativePathTopSource; } -const char* cmStateDirectory::GetRelativePathTopBinary() const +std::string const& cmStateDirectory::GetRelativePathTopBinary() const { - return this->DirectoryState->RelativePathTopBinary.c_str(); + return this->DirectoryState->RelativePathTopBinary; } void cmStateDirectory::SetRelativePathTopSource(const char* dir) @@ -474,7 +474,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop, if (prop == "PARENT_DIRECTORY") { cmStateSnapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent(); if (parent.IsValid()) { - return parent.GetDirectory().GetCurrentSource(); + return parent.GetDirectory().GetCurrentSource().c_str(); } return ""; } diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h index bc96cc9..412664f 100644 --- a/Source/cmStateDirectory.h +++ b/Source/cmStateDirectory.h @@ -22,13 +22,13 @@ class cmStateDirectory cmStateSnapshot const& snapshot); public: - const char* GetCurrentSource() const; + std::string const& GetCurrentSource() const; void SetCurrentSource(std::string const& dir); - const char* GetCurrentBinary() const; + std::string const& GetCurrentBinary() const; void SetCurrentBinary(std::string const& dir); - const char* GetRelativePathTopSource() const; - const char* GetRelativePathTopBinary() const; + std::string const& GetRelativePathTopSource() const; + std::string const& GetRelativePathTopBinary() const; void SetRelativePathTopSource(const char* dir); void SetRelativePathTopBinary(const char* dir); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 380ac88..cc5a176 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1415,13 +1415,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const return this->GetMakefile() ->GetStateSnapshot() .GetDirectory() - .GetCurrentBinary(); + .GetCurrentBinary() + .c_str(); } if (prop == propSOURCE_DIR) { return this->GetMakefile() ->GetStateSnapshot() .GetDirectory() - .GetCurrentSource(); + .GetCurrentSource() + .c_str(); } } |