Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: tools/gn/value.cc

Issue 1350043004: Cleanup: Initialize Value from tools/gn by moving std::string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« tools/gn/value.h ('K') | « tools/gn/value.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/value.cc
diff --git a/tools/gn/value.cc b/tools/gn/value.cc
index 32a96ff7fc0672b7cca8992f8c8e6ff296c819ab..681a6c0ce9cf175bf2117a1c868f600e44b0c5da 100644
--- a/tools/gn/value.cc
+++ b/tools/gn/value.cc
@@ -36,14 +36,19 @@ Value::Value(const ParseNode* origin, int64_t int_val)
origin_(origin) {
}
-Value::Value(const ParseNode* origin, std::string str_val)
+Value::Value(const ParseNode* origin, const std::string& str_val)
: type_(STRING),
- string_value_(),
+ string_value_(str_val),
boolean_value_(false),
int_value_(0),
- origin_(origin) {
- string_value_.swap(str_val);
-}
+ origin_(origin) {}
+
+Value::Value(const ParseNode* origin, std::string&& str_val) noexcept
+ : type_(STRING),
+ string_value_(std::move(str_val)),
+ boolean_value_(false),
+ int_value_(0),
+ origin_(origin) {}
Value::Value(const ParseNode* origin, const char* str_val)
: type_(STRING),
« tools/gn/value.h ('K') | « tools/gn/value.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698