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

Side by Side Diff: tools/gn/scope.h

Issue 2940873002: Implement tracking of BUILD.gn files used to define target, toolchain or (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « tools/gn/runtime_deps_unittest.cc ('k') | tools/gn/scope.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef TOOLS_GN_SCOPE_H_ 5 #ifndef TOOLS_GN_SCOPE_H_
6 #define TOOLS_GN_SCOPE_H_ 6 #define TOOLS_GN_SCOPE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // so won't trigger an unused variable warning. You want this when doing an 92 // so won't trigger an unused variable warning. You want this when doing an
93 // import, for example, or files that don't need a variable from the .gni 93 // import, for example, or files that don't need a variable from the .gni
94 // file will throw an error. 94 // file will throw an error.
95 bool mark_dest_used; 95 bool mark_dest_used;
96 96
97 // When set, those variables are not merged. 97 // When set, those variables are not merged.
98 std::set<std::string> excluded_values; 98 std::set<std::string> excluded_values;
99 }; 99 };
100 100
101 // Creates an empty toplevel scope. 101 // Creates an empty toplevel scope.
102 explicit Scope(const Settings* settings); 102 Scope(const Settings* settings,
103 const std::set<uint32_t>& source_files_hashes);
brettw 2017/06/27 00:50:40 I believe a base::flat_set<uint32_t> will be more
alex-ac 2017/06/27 13:46:31 Done.
103 104
104 // Creates a dependent scope. 105 // Creates a dependent scope.
105 explicit Scope(Scope* parent); 106 explicit Scope(Scope* parent);
106 explicit Scope(const Scope* parent); 107 explicit Scope(const Scope* parent);
107 108
108 ~Scope(); 109 ~Scope();
109 110
110 const Settings* settings() const { return settings_; } 111 const Settings* settings() const { return settings_; }
111 112
112 // See the const_/mutable_containing_ var declarations below. Yes, it's a 113 // See the const_/mutable_containing_ var declarations below. Yes, it's a
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 void SetProcessingImport(); 277 void SetProcessingImport();
277 void ClearProcessingImport(); 278 void ClearProcessingImport();
278 bool IsProcessingImport() const; 279 bool IsProcessingImport() const;
279 280
280 // The source directory associated with this scope. This will check embedded 281 // The source directory associated with this scope. This will check embedded
281 // scopes until it finds a nonempty source directory. This will default to 282 // scopes until it finds a nonempty source directory. This will default to
282 // an empty dir if no containing scope has a source dir set. 283 // an empty dir if no containing scope has a source dir set.
283 const SourceDir& GetSourceDir() const; 284 const SourceDir& GetSourceDir() const;
284 void set_source_dir(const SourceDir& d) { source_dir_ = d; } 285 void set_source_dir(const SourceDir& d) { source_dir_ = d; }
285 286
287 // The set of source files which affected this scope.
288 const std::set<uint32_t>& source_files_hashes() const {
289 return source_files_hashes_;
290 }
291 void AddSourceFile(const SourceFile& source_file);
292
286 // The item collector is where Items (Targets, Configs, etc.) go that have 293 // The item collector is where Items (Targets, Configs, etc.) go that have
287 // been defined. If a scope can generate items, this non-owning pointer will 294 // been defined. If a scope can generate items, this non-owning pointer will
288 // point to the storage for such items. The creator of this scope will be 295 // point to the storage for such items. The creator of this scope will be
289 // responsible for setting up the collector and then dealing with the 296 // responsible for setting up the collector and then dealing with the
290 // collected items once execution of the context is complete. 297 // collected items once execution of the context is complete.
291 // 298 //
292 // The items in a scope are collected as we go and then dispatched at the end 299 // The items in a scope are collected as we go and then dispatched at the end
293 // of execution of a scope so that we can query the previously-generated 300 // of execution of a scope so that we can query the previously-generated
294 // targets (like getting the outputs). 301 // targets (like getting the outputs).
295 // 302 //
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 378
372 // Opaque pointers. See SetProperty() above. 379 // Opaque pointers. See SetProperty() above.
373 typedef std::map<const void*, void*> PropertyMap; 380 typedef std::map<const void*, void*> PropertyMap;
374 PropertyMap properties_; 381 PropertyMap properties_;
375 382
376 typedef std::set<ProgrammaticProvider*> ProviderSet; 383 typedef std::set<ProgrammaticProvider*> ProviderSet;
377 ProviderSet programmatic_providers_; 384 ProviderSet programmatic_providers_;
378 385
379 SourceDir source_dir_; 386 SourceDir source_dir_;
380 387
388 std::set<uint32_t> source_files_hashes_;
389
381 DISALLOW_COPY_AND_ASSIGN(Scope); 390 DISALLOW_COPY_AND_ASSIGN(Scope);
382 }; 391 };
383 392
384 #endif // TOOLS_GN_SCOPE_H_ 393 #endif // TOOLS_GN_SCOPE_H_
OLDNEW
« no previous file with comments | « tools/gn/runtime_deps_unittest.cc ('k') | tools/gn/scope.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698