cmOutputConverter: remove 'optional' argument

Remove the 'optional' paramenter from the second overload of the Convert
function.  This parameter is used from one single location.  Inline the
codepath for which the argument is true to the callsite.
This commit is contained in:
Daniel Pfeifer 2016-06-20 22:31:57 +02:00
parent cde127b084
commit b86007e385
2 changed files with 13 additions and 7 deletions

View File

@ -61,11 +61,19 @@ std::string cmOutputConverter::ConvertToOutputForExisting(
std::string cmOutputConverter::ConvertToOutputForExisting( std::string cmOutputConverter::ConvertToOutputForExisting(
RelativeRoot remote, const std::string& local, OutputFormat format) const RelativeRoot remote, const std::string& local, OutputFormat format) const
{ {
static_cast<void>(local);
// The relative root must have a path (i.e. not FULL or NONE)
assert(remote != FULL);
assert(remote != NONE);
const char* remotePath = this->GetRelativeRootPath(remote);
assert(remotePath != 0);
// Perform standard conversion. // Perform standard conversion.
std::string result = this->Convert(remote, local, format, true); std::string result = this->ConvertToOutputFormat(remotePath, format);
// Consider short-path. // Consider short-path.
const char* remotePath = this->GetRelativeRootPath(remote);
return this->ConvertToOutputForExistingCommon(remotePath, result, format); return this->ConvertToOutputForExistingCommon(remotePath, result, format);
} }
@ -158,8 +166,7 @@ std::string cmOutputConverter::ConvertDirectorySeparatorsForShell(
std::string cmOutputConverter::Convert(RelativeRoot remote, std::string cmOutputConverter::Convert(RelativeRoot remote,
const std::string& local, const std::string& local,
OutputFormat output, OutputFormat output) const
bool optional) const
{ {
// The relative root must have a path (i.e. not FULL or NONE) // The relative root must have a path (i.e. not FULL or NONE)
assert(remote != FULL); assert(remote != FULL);
@ -168,7 +175,7 @@ std::string cmOutputConverter::Convert(RelativeRoot remote,
const char* remotePath = this->GetRelativeRootPath(remote); const char* remotePath = this->GetRelativeRootPath(remote);
assert(remotePath != 0); assert(remotePath != 0);
if (local.empty() || optional) { if (local.empty()) {
return this->ConvertToOutputFormat(remotePath, output); return this->ConvertToOutputFormat(remotePath, output);
} }

View File

@ -58,8 +58,7 @@ public:
std::string Convert(const std::string& remote, RelativeRoot local, std::string Convert(const std::string& remote, RelativeRoot local,
OutputFormat output = UNCHANGED) const; OutputFormat output = UNCHANGED) const;
std::string Convert(RelativeRoot remote, const std::string& local, std::string Convert(RelativeRoot remote, const std::string& local,
OutputFormat output = UNCHANGED, OutputFormat output = UNCHANGED) const;
bool optional = false) const;
std::string ConvertDirectorySeparatorsForShell( std::string ConvertDirectorySeparatorsForShell(
const std::string& source) const; const std::string& source) const;