clang-tidy: Enable performance-inefficient-string-concatenation
This check warns about the performance overhead arising from
concatenating strings using the operator+
Change-Id: I93a5797adb0ffc9aa1d2353bab0a5ff6773ec6d5
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/.clang-tidy b/.clang-tidy
index e3c8194..15ad58f 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -219,6 +219,7 @@
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
+performance-inefficient-string-concatenation,
performance-inefficient-vector-operation,
performance-move-const-arg,
performance-move-constructor-init,
diff --git a/test/utest.cpp b/test/utest.cpp
index 778c845..9e55f2a 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -408,10 +408,15 @@
TEST_F(FileTest, TestMergeFiles)
{
std::string retFile = tmpDir + "/retFile";
+ std::stringstream ss;
+ ss << "cat";
for (const auto& file : srcFiles)
{
- command("cat " + file + " >> " + retFile);
+ ss << " " << file;
}
+ ss << " >> " << retFile;
+ std::string catCommand = ss.str();
+ command(catCommand);
std::string dstFile = tmpDir + "/dstFile";
utils::mergeFiles(srcFiles, dstFile);