Commit ada121e5 authored by Vitaly Stakhovsky's avatar Vitaly Stakhovsky Committed by Craig Scott
Browse files

cmStateDirectory: use const std::string& for return values

parent eba2b13a
...@@ -2524,12 +2524,12 @@ std::string const& cmLocalGenerator::GetBinaryDirectory() const ...@@ -2524,12 +2524,12 @@ std::string const& cmLocalGenerator::GetBinaryDirectory() const
const char* cmLocalGenerator::GetCurrentBinaryDirectory() const const char* cmLocalGenerator::GetCurrentBinaryDirectory() const
{ {
return this->StateSnapshot.GetDirectory().GetCurrentBinary(); return this->StateSnapshot.GetDirectory().GetCurrentBinary().c_str();
} }
const char* cmLocalGenerator::GetCurrentSourceDirectory() const const char* cmLocalGenerator::GetCurrentSourceDirectory() const
{ {
return this->StateSnapshot.GetDirectory().GetCurrentSource(); return this->StateSnapshot.GetDirectory().GetCurrentSource().c_str();
} }
std::string cmLocalGenerator::GetTargetDirectory( std::string cmLocalGenerator::GetTargetDirectory(
......
...@@ -1637,12 +1637,12 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, ...@@ -1637,12 +1637,12 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
const char* cmMakefile::GetCurrentSourceDirectory() const const char* cmMakefile::GetCurrentSourceDirectory() const
{ {
return this->StateSnapshot.GetDirectory().GetCurrentSource(); return this->StateSnapshot.GetDirectory().GetCurrentSource().c_str();
} }
const char* cmMakefile::GetCurrentBinaryDirectory() const const char* cmMakefile::GetCurrentBinaryDirectory() const
{ {
return this->StateSnapshot.GetDirectory().GetCurrentBinary(); return this->StateSnapshot.GetDirectory().GetCurrentBinary().c_str();
} }
std::vector<cmTarget*> cmMakefile::GetImportedTargets() const std::vector<cmTarget*> cmMakefile::GetImportedTargets() const
......
...@@ -83,9 +83,9 @@ bool cmOutputConverter::ContainedInDirectory(std::string const& local_path, ...@@ -83,9 +83,9 @@ bool cmOutputConverter::ContainedInDirectory(std::string const& local_path,
std::string const& remote_path, std::string const& remote_path,
cmStateDirectory const& directory) cmStateDirectory const& directory)
{ {
const std::string relativePathTopBinary = const std::string& relativePathTopBinary =
directory.GetRelativePathTopBinary(); directory.GetRelativePathTopBinary();
const std::string relativePathTopSource = const std::string& relativePathTopSource =
directory.GetRelativePathTopSource(); directory.GetRelativePathTopSource();
const bool bothInBinary = const bool bothInBinary =
......
...@@ -84,9 +84,9 @@ void cmStateDirectory::ComputeRelativePathTopBinary() ...@@ -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) void cmStateDirectory::SetCurrentSource(std::string const& dir)
...@@ -101,9 +101,9 @@ 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); 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) void cmStateDirectory::SetCurrentBinary(std::string const& dir)
...@@ -118,14 +118,14 @@ 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); 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) void cmStateDirectory::SetRelativePathTopSource(const char* dir)
...@@ -474,7 +474,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop, ...@@ -474,7 +474,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop,
if (prop == "PARENT_DIRECTORY") { if (prop == "PARENT_DIRECTORY") {
cmStateSnapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent(); cmStateSnapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent();
if (parent.IsValid()) { if (parent.IsValid()) {
return parent.GetDirectory().GetCurrentSource(); return parent.GetDirectory().GetCurrentSource().c_str();
} }
return ""; return "";
} }
......
...@@ -22,13 +22,13 @@ class cmStateDirectory ...@@ -22,13 +22,13 @@ class cmStateDirectory
cmStateSnapshot const& snapshot); cmStateSnapshot const& snapshot);
public: public:
const char* GetCurrentSource() const; std::string const& GetCurrentSource() const;
void SetCurrentSource(std::string const& dir); void SetCurrentSource(std::string const& dir);
const char* GetCurrentBinary() const; std::string const& GetCurrentBinary() const;
void SetCurrentBinary(std::string const& dir); void SetCurrentBinary(std::string const& dir);
const char* GetRelativePathTopSource() const; std::string const& GetRelativePathTopSource() const;
const char* GetRelativePathTopBinary() const; std::string const& GetRelativePathTopBinary() const;
void SetRelativePathTopSource(const char* dir); void SetRelativePathTopSource(const char* dir);
void SetRelativePathTopBinary(const char* dir); void SetRelativePathTopBinary(const char* dir);
......
...@@ -1415,13 +1415,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const ...@@ -1415,13 +1415,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const
return this->GetMakefile() return this->GetMakefile()
->GetStateSnapshot() ->GetStateSnapshot()
.GetDirectory() .GetDirectory()
.GetCurrentBinary(); .GetCurrentBinary()
.c_str();
} }
if (prop == propSOURCE_DIR) { if (prop == propSOURCE_DIR) {
return this->GetMakefile() return this->GetMakefile()
->GetStateSnapshot() ->GetStateSnapshot()
.GetDirectory() .GetDirectory()
.GetCurrentSource(); .GetCurrentSource()
.c_str();
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment