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

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: Use base::flat_set instead of std::set. Created 3 years, 5 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
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>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
17 #include "tools/gn/err.h" 17 #include "tools/gn/err.h"
18 #include "tools/gn/input_file.h"
18 #include "tools/gn/pattern.h" 19 #include "tools/gn/pattern.h"
19 #include "tools/gn/source_dir.h" 20 #include "tools/gn/source_dir.h"
20 #include "tools/gn/value.h" 21 #include "tools/gn/value.h"
21 22
22 class Item; 23 class Item;
23 class ParseNode; 24 class ParseNode;
24 class Settings; 25 class Settings;
25 class Template; 26 class Template;
26 27
27 // Scope for the script execution. 28 // Scope for the script execution.
(...skipping 64 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 93 // 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 94 // import, for example, or files that don't need a variable from the .gni
94 // file will throw an error. 95 // file will throw an error.
95 bool mark_dest_used; 96 bool mark_dest_used;
96 97
97 // When set, those variables are not merged. 98 // When set, those variables are not merged.
98 std::set<std::string> excluded_values; 99 std::set<std::string> excluded_values;
99 }; 100 };
100 101
101 // Creates an empty toplevel scope. 102 // Creates an empty toplevel scope.
102 explicit Scope(const Settings* settings); 103 Scope(const Settings* settings, const InputFileSet& input_files);
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 InputFileSet& input_files() const { return input_files_; }
289 void AddInputFile(const InputFile* input_file);
290
286 // The item collector is where Items (Targets, Configs, etc.) go that have 291 // 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 292 // 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 293 // 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 294 // responsible for setting up the collector and then dealing with the
290 // collected items once execution of the context is complete. 295 // collected items once execution of the context is complete.
291 // 296 //
292 // The items in a scope are collected as we go and then dispatched at the end 297 // 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 298 // of execution of a scope so that we can query the previously-generated
294 // targets (like getting the outputs). 299 // targets (like getting the outputs).
295 // 300 //
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 376
372 // Opaque pointers. See SetProperty() above. 377 // Opaque pointers. See SetProperty() above.
373 typedef std::map<const void*, void*> PropertyMap; 378 typedef std::map<const void*, void*> PropertyMap;
374 PropertyMap properties_; 379 PropertyMap properties_;
375 380
376 typedef std::set<ProgrammaticProvider*> ProviderSet; 381 typedef std::set<ProgrammaticProvider*> ProviderSet;
377 ProviderSet programmatic_providers_; 382 ProviderSet programmatic_providers_;
378 383
379 SourceDir source_dir_; 384 SourceDir source_dir_;
380 385
386 InputFileSet input_files_;
387
381 DISALLOW_COPY_AND_ASSIGN(Scope); 388 DISALLOW_COPY_AND_ASSIGN(Scope);
382 }; 389 };
383 390
384 #endif // TOOLS_GN_SCOPE_H_ 391 #endif // TOOLS_GN_SCOPE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698