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

Unified Diff: tools/gn/parse_tree.h

Issue 1884503003: GN: Replace vector<ParseNode*> with vector<unique_ptr<ParseNode>> in parse_tree.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove comments Created 4 years, 8 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
« no previous file with comments | « tools/gn/functions.cc ('k') | tools/gn/parse_tree.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/parse_tree.h
diff --git a/tools/gn/parse_tree.h b/tools/gn/parse_tree.h
index 28537992068d1809abdb2643884e1ef3e2a284be..48313bea7f231c8653f1a3b3e6a711a93f910aef 100644
--- a/tools/gn/parse_tree.h
+++ b/tools/gn/parse_tree.h
@@ -227,9 +227,11 @@ class BlockNode : public ParseNode {
void set_end(std::unique_ptr<EndNode> e) { end_ = std::move(e); }
const EndNode* End() const { return end_.get(); }
- const std::vector<ParseNode*>& statements() const { return statements_; }
+ const std::vector<std::unique_ptr<ParseNode>>& statements() const {
+ return statements_;
+ }
void append_statement(std::unique_ptr<ParseNode> s) {
- statements_.push_back(s.release());
+ statements_.push_back(std::move(s));
}
private:
@@ -238,8 +240,7 @@ class BlockNode : public ParseNode {
Token begin_token_;
std::unique_ptr<EndNode> end_;
- // Owning pointers, use unique_ptr when we can use C++11.
- std::vector<ParseNode*> statements_;
+ std::vector<std::unique_ptr<ParseNode>> statements_;
DISALLOW_COPY_AND_ASSIGN(BlockNode);
};
@@ -364,9 +365,11 @@ class ListNode : public ParseNode {
const EndNode* End() const { return end_.get(); }
void append_item(std::unique_ptr<ParseNode> s) {
- contents_.push_back(s.release());
+ contents_.push_back(std::move(s));
+ }
+ const std::vector<std::unique_ptr<const ParseNode>>& contents() const {
+ return contents_;
}
- const std::vector<const ParseNode*>& contents() const { return contents_; }
void SortAsStringsList();
void SortAsDepsList();
@@ -397,8 +400,7 @@ class ListNode : public ParseNode {
std::unique_ptr<EndNode> end_;
bool prefer_multiline_;
- // Owning pointers, use unique_ptr when we can use C++11.
- std::vector<const ParseNode*> contents_;
+ std::vector<std::unique_ptr<const ParseNode>> contents_;
DISALLOW_COPY_AND_ASSIGN(ListNode);
};
« no previous file with comments | « tools/gn/functions.cc ('k') | tools/gn/parse_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698