clang-tidy: apply performance-unnecessary-value-param fixes

This commit is contained in:
Daniel Pfeifer
2016-12-10 14:42:49 +01:00
committed by Brad King
parent b88843d651
commit 7c9db8f813
6 changed files with 19 additions and 14 deletions
+4 -4
View File
@@ -242,7 +242,7 @@ std::string cmJoin(Range const& r, const char* delimiter)
} }
template <typename Range> template <typename Range>
std::string cmJoin(Range const& r, std::string delimiter) std::string cmJoin(Range const& r, std::string const& delimiter)
{ {
return cmJoin(r, delimiter.c_str()); return cmJoin(r, delimiter.c_str());
} }
@@ -344,13 +344,13 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r)
} }
template <typename Range> template <typename Range>
std::string cmWrap(std::string prefix, Range const& r, std::string suffix, std::string cmWrap(std::string const& prefix, Range const& r,
std::string sep) std::string const& suffix, std::string const& sep)
{ {
if (r.empty()) { if (r.empty()) {
return std::string(); return std::string();
} }
return prefix + cmJoin(r, (suffix + sep + prefix).c_str()) + suffix; return prefix + cmJoin(r, suffix + sep + prefix) + suffix;
} }
template <typename Range> template <typename Range>
+1 -1
View File
@@ -242,7 +242,7 @@ public:
/** Used for parallel ctest job scheduling */ /** Used for parallel ctest job scheduling */
std::string GetScheduleType() { return this->ScheduleType; } std::string GetScheduleType() { return this->ScheduleType; }
void SetScheduleType(std::string type) { this->ScheduleType = type; } void SetScheduleType(std::string const& type) { this->ScheduleType = type; }
/** The max output width */ /** The max output width */
int GetMaxTestNameWidth() const; int GetMaxTestNameWidth() const;
+4 -2
View File
@@ -65,13 +65,15 @@ private:
struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
{ {
GeneratorExpressionContent(const char* startContent, size_t length); GeneratorExpressionContent(const char* startContent, size_t length);
void SetIdentifier(std::vector<cmGeneratorExpressionEvaluator*> identifier) void SetIdentifier(
std::vector<cmGeneratorExpressionEvaluator*> const& identifier)
{ {
this->IdentifierChildren = identifier; this->IdentifierChildren = identifier;
} }
void SetParameters( void SetParameters(
std::vector<std::vector<cmGeneratorExpressionEvaluator*> > parameters) std::vector<std::vector<cmGeneratorExpressionEvaluator*> > const&
parameters)
{ {
this->ParamChildren = parameters; this->ParamChildren = parameters;
} }
+1 -1
View File
@@ -148,7 +148,7 @@ public:
void AppendDefines(std::set<std::string>& defines, void AppendDefines(std::set<std::string>& defines,
const char* defines_list) const; const char* defines_list) const;
void AppendDefines(std::set<std::string>& defines, void AppendDefines(std::set<std::string>& defines,
std::string defines_list) const std::string const& defines_list) const
{ {
this->AppendDefines(defines, defines_list.c_str()); this->AppendDefines(defines, defines_list.c_str());
} }
+8 -5
View File
@@ -9,7 +9,8 @@ unsigned int cmProcessOutput::defaultCodepage =
KWSYS_ENCODING_DEFAULT_CODEPAGE; KWSYS_ENCODING_DEFAULT_CODEPAGE;
#endif #endif
cmProcessOutput::Encoding cmProcessOutput::FindEncoding(std::string name) cmProcessOutput::Encoding cmProcessOutput::FindEncoding(
std::string const& name)
{ {
Encoding encoding = Auto; Encoding encoding = Auto;
if (name == "UTF8") { if (name == "UTF8") {
@@ -54,9 +55,13 @@ cmProcessOutput::~cmProcessOutput()
bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded, bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded,
size_t id) size_t id)
{ {
#if !defined(_WIN32)
static_cast<void>(id);
decoded.swap(raw);
return true;
#else
bool success = true; bool success = true;
decoded = raw; decoded = raw;
#if defined(_WIN32)
if (id > 0) { if (id > 0) {
if (rawparts.size() < id) { if (rawparts.size() < id) {
rawparts.reserve(id); rawparts.reserve(id);
@@ -113,10 +118,8 @@ bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded,
success = DoDecodeText(raw, decoded, NULL); success = DoDecodeText(raw, decoded, NULL);
} }
} }
#else
static_cast<void>(id);
#endif
return success; return success;
#endif
} }
bool cmProcessOutput::DecodeText(const char* data, size_t length, bool cmProcessOutput::DecodeText(const char* data, size_t length,
+1 -1
View File
@@ -32,7 +32,7 @@ public:
* \param name a encoding name. * \param name a encoding name.
* \return encoding enum value or Auto if \a name was not found. * \return encoding enum value or Auto if \a name was not found.
*/ */
static Encoding FindEncoding(std::string name); static Encoding FindEncoding(std::string const& name);
/// The code page that is used as internal encoding to which we will encode. /// The code page that is used as internal encoding to which we will encode.
static unsigned int defaultCodepage; static unsigned int defaultCodepage;