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

Unified Diff: tools/gn/scope.cc

Issue 2936923002: Add not_needed function (Closed)
Patch Set: Rebase Created 3 years, 6 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/scope.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/scope.cc
diff --git a/tools/gn/scope.cc b/tools/gn/scope.cc
index f2fe7521dfafc8e94f5a6c35ff2723a9ec960c9f..437fdba835e083d186005d20f3f4c82e5d711faa 100644
--- a/tools/gn/scope.cc
+++ b/tools/gn/scope.cc
@@ -219,6 +219,16 @@ void Scope::MarkAllUsed() {
cur.second.used = true;
}
+void Scope::MarkAllUsed(const std::set<std::string>& excluded_values) {
+ for (auto& cur : values_) {
+ if (!excluded_values.empty() &&
+ excluded_values.find(cur.first.as_string()) != excluded_values.end()) {
+ continue; // Skip this excluded value.
+ }
+ cur.second.used = true;
+ }
+}
+
void Scope::MarkUnused(const base::StringPiece& ident) {
RecordMap::iterator found = values_.find(ident);
if (found == values_.end()) {
« no previous file with comments | « tools/gn/scope.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698