|
18 | 18 | #include <memory> |
19 | 19 | #include <set> |
20 | 20 | #include <string> |
| 21 | +#include <utility> |
21 | 22 | #include <unordered_map> |
22 | 23 | #include <vector> |
23 | 24 | #if __cplusplus >= 202002L |
@@ -127,8 +128,8 @@ namespace simplecpp { |
127 | 128 | */ |
128 | 129 | class SIMPLECPP_LIB Token { |
129 | 130 | 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)) { |
132 | 133 | flags(); |
133 | 134 | } |
134 | 135 |
|
@@ -220,7 +221,7 @@ namespace simplecpp { |
220 | 221 | FILE_NOT_FOUND, |
221 | 222 | DUI_ERROR |
222 | 223 | } 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)) {} |
224 | 225 | Location location; |
225 | 226 | std::string msg; |
226 | 227 | }; |
@@ -387,7 +388,7 @@ namespace simplecpp { |
387 | 388 |
|
388 | 389 | /** Tracking #if/#elif expressions */ |
389 | 390 | 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) {} |
391 | 392 | Location location; // location of #if/#elif |
392 | 393 | std::string E; // preprocessed condition |
393 | 394 | long long result; // condition result |
|
0 commit comments