summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-12-10 13:42:49 (GMT)
committerBrad King <brad.king@kitware.com>2016-12-12 19:04:12 (GMT)
commit7c9db8f8139b945d4c55d9061e4ef122351b210d (patch)
treedd2d523653994aeeb93e949550e3ac4ef27058be
parentb88843d651dc2c500af13c1fe882b389c4949b04 (diff)
downloadCMake-7c9db8f8139b945d4c55d9061e4ef122351b210d.zip
CMake-7c9db8f8139b945d4c55d9061e4ef122351b210d.tar.gz
CMake-7c9db8f8139b945d4c55d9061e4ef122351b210d.tar.bz2
clang-tidy: apply performance-unnecessary-value-param fixes
-rw-r--r--Source/cmAlgorithms.h8
-rw-r--r--Source/cmCTest.h2
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h6
-rw-r--r--Source/cmLocalGenerator.h2
-rw-r--r--Source/cmProcessOutput.cxx13
-rw-r--r--Source/cmProcessOutput.h2
6 files changed, 19 insertions, 14 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 22f69fa..7c683ad 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -242,7 +242,7 @@ std::string cmJoin(Range const& r, const char* delimiter)
}
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());
}
@@ -344,13 +344,13 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r)
}
template <typename Range>
-std::string cmWrap(std::string prefix, Range const& r, std::string suffix,
- std::string sep)
+std::string cmWrap(std::string const& prefix, Range const& r,
+ std::string const& suffix, std::string const& sep)
{
if (r.empty()) {
return std::string();
}
- return prefix + cmJoin(r, (suffix + sep + prefix).c_str()) + suffix;
+ return prefix + cmJoin(r, suffix + sep + prefix) + suffix;
}
template <typename Range>
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 8db2e5f..8fc646f 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -242,7 +242,7 @@ public:
/** Used for parallel ctest job scheduling */
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 */
int GetMaxTestNameWidth() const;
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index 122e9cf..41bea9b 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -65,13 +65,15 @@ private:
struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
{
GeneratorExpressionContent(const char* startContent, size_t length);
- void SetIdentifier(std::vector<cmGeneratorExpressionEvaluator*> identifier)
+ void SetIdentifier(
+ std::vector<cmGeneratorExpressionEvaluator*> const& identifier)
{
this->IdentifierChildren = identifier;
}
void SetParameters(
- std::vector<std::vector<cmGeneratorExpressionEvaluator*> > parameters)
+ std::vector<std::vector<cmGeneratorExpressionEvaluator*> > const&
+ parameters)
{
this->ParamChildren = parameters;
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index fdca78a..901ca35 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -148,7 +148,7 @@ public:
void AppendDefines(std::set<std::string>& defines,
const char* defines_list) const;
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());
}
diff --git a/Source/cmProcessOutput.cxx b/Source/cmProcessOutput.cxx
index 8b4d0e1..617e1ca 100644
--- a/Source/cmProcessOutput.cxx
+++ b/Source/cmProcessOutput.cxx
@@ -9,7 +9,8 @@ unsigned int cmProcessOutput::defaultCodepage =
KWSYS_ENCODING_DEFAULT_CODEPAGE;
#endif
-cmProcessOutput::Encoding cmProcessOutput::FindEncoding(std::string name)
+cmProcessOutput::Encoding cmProcessOutput::FindEncoding(
+ std::string const& name)
{
Encoding encoding = Auto;
if (name == "UTF8") {
@@ -54,9 +55,13 @@ cmProcessOutput::~cmProcessOutput()
bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded,
size_t id)
{
+#if !defined(_WIN32)
+ static_cast<void>(id);
+ decoded.swap(raw);
+ return true;
+#else
bool success = true;
decoded = raw;
-#if defined(_WIN32)
if (id > 0) {
if (rawparts.size() < id) {
rawparts.reserve(id);
@@ -113,10 +118,8 @@ bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded,
success = DoDecodeText(raw, decoded, NULL);
}
}
-#else
- static_cast<void>(id);
-#endif
return success;
+#endif
}
bool cmProcessOutput::DecodeText(const char* data, size_t length,
diff --git a/Source/cmProcessOutput.h b/Source/cmProcessOutput.h
index 6046f57..d2e631f 100644
--- a/Source/cmProcessOutput.h
+++ b/Source/cmProcessOutput.h
@@ -32,7 +32,7 @@ public:
* \param name a encoding name.
* \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.
static unsigned int defaultCodepage;