Skip to content

Commit 2f9fbfd

Browse files
committed
enabled and fixed modernize-pass-by-value clang-tidy warnings
1 parent 37fa4f4 commit 2f9fbfd

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Checks: >
2828
-misc-use-anonymous-namespace,
2929
-modernize-avoid-c-arrays,
3030
-modernize-loop-convert,
31-
-modernize-pass-by-value,
3231
-modernize-return-braced-init-list,
3332
-modernize-use-auto,
3433
-modernize-use-emplace,

simplecpp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ namespace simplecpp {
16431643

16441644
/** base class for errors */
16451645
struct Error {
1646-
Error(const Location &loc, const std::string &s) : location(loc), what(s) {}
1646+
Error(const Location &loc, std::string s) : location(loc), what(std::move(s)) {}
16471647
const Location location;
16481648
const std::string what;
16491649
};

simplecpp.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <memory>
1919
#include <set>
2020
#include <string>
21+
#include <utility>
2122
#include <unordered_map>
2223
#include <vector>
2324
#if __cplusplus >= 202002L
@@ -127,8 +128,8 @@ namespace simplecpp {
127128
*/
128129
class SIMPLECPP_LIB Token {
129130
public:
130-
Token(const TokenString &s, const Location &loc, bool wsahead = false) :
131-
whitespaceahead(wsahead), location(loc), previous(nullptr), next(nullptr), nextcond(nullptr), string(s) {
131+
Token(TokenString s, const Location &loc, bool wsahead = false) :
132+
whitespaceahead(wsahead), location(loc), previous(nullptr), next(nullptr), nextcond(nullptr), string(std::move(s)) {
132133
flags();
133134
}
134135

@@ -220,7 +221,7 @@ namespace simplecpp {
220221
FILE_NOT_FOUND,
221222
DUI_ERROR
222223
} type;
223-
explicit Output(const std::vector<std::string>& files, Type type, const std::string& msg) : type(type), location(files), msg(msg) {}
224+
explicit Output(const std::vector<std::string>& files, Type type, std::string msg) : type(type), location(files), msg(std::move(msg)) {}
224225
Location location;
225226
std::string msg;
226227
};
@@ -387,7 +388,7 @@ namespace simplecpp {
387388

388389
/** Tracking #if/#elif expressions */
389390
struct SIMPLECPP_LIB IfCond {
390-
explicit IfCond(const Location& location, const std::string &E, long long result) : location(location), E(E), result(result) {}
391+
explicit IfCond(const Location& location, std::string E, long long result) : location(location), E(std::move(E)), result(result) {}
391392
Location location; // location of #if/#elif
392393
std::string E; // preprocessed condition
393394
long long result; // condition result

0 commit comments

Comments
 (0)