mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-12 20:39:49 -05:00
cmStateDirectory: use const std::string& for return values
This commit is contained in:
committed by
Craig Scott
parent
eba2b13a83
commit
ada121e573
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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 "";
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user