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

Unified Diff: tools/gn/args.h

Issue 984353002: Makes declared_arguments per toolchain (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 5 years, 9 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/BUILD.gn ('k') | tools/gn/args.cc » ('j') | tools/gn/args.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/args.h
diff --git a/tools/gn/args.h b/tools/gn/args.h
index 6852c30930076f5346d021f431cec179e4fd2a4b..e5343b08da408044bbcb5a7bfadd3d470bd2c413 100644
--- a/tools/gn/args.h
+++ b/tools/gn/args.h
@@ -61,6 +61,15 @@ class Args {
// arguments. If there are, this returns false and sets the error.
bool VerifyAllOverridesUsed(Err* err) const;
+ // Adds all declared arguments to the given output list. If the values exist
+ // in the list already, their values will be overwriten, but other values
+ // already in the list will remain.
+ void MergeDeclaredArguments(Scope::KeyValueMap* dest) const;
+
+ private:
+ using DeclaredArgumentsPerToolchain =
+ base::hash_map<const Settings*, Scope::KeyValueMap>;
+
// Like VerifyAllOverridesUsed but takes the lists of overrides specified and
// parameters declared.
static bool VerifyAllOverridesUsed(
sky 2015/03/13 20:43:13 I moved this to the private block as no one but th
@@ -68,12 +77,6 @@ class Args {
const Scope::KeyValueMap& declared_arguments,
Err* err);
- // Adds all declared arguments to the given output list. If the values exist
- // in the list already, their values will be overwriten, but other values
- // already in the list will remain.
- void MergeDeclaredArguments(Scope::KeyValueMap* dest) const;
-
- private:
// Sets the default config based on the current system.
void SetSystemVarsLocked(Scope* scope) const;
@@ -83,6 +86,11 @@ class Args {
void SaveOverrideRecordLocked(const Scope::KeyValueMap& values) const;
+ // Returns the KeyValueMap used for arguments declared for the specified
+ // toolchain.
+ // NOTE: this does not grab a lock.
brettw 2015/03/14 05:14:32 I was calling such functions ...Locked. I think if
sky 2015/03/16 16:20:45 Done.
+ Scope::KeyValueMap& DeclaredArgumentsForToolchain(Scope* scope) const;
+
// Since this is called during setup which we assume is single-threaded,
// this is not protected by the lock. It should be set only during init.
Scope::KeyValueMap overrides_;
@@ -94,9 +102,12 @@ class Args {
// check for overrides that were specified but never used.
mutable Scope::KeyValueMap all_overrides_;
- // Tracks all variables declared in any buildfile. This is so we can see if
- // the user set variables on the command line that are not used anywhere.
- mutable Scope::KeyValueMap declared_arguments_;
+ // Maps from Settings (which corresponds to a toolchain) to the map of
+ // declared variables. This is used to tracks all variables declared in any
+ // buildfile. This is so we can see if the user set variables on the command
+ // line that are not used anywhere. Each map is toolchain specific as each
+ // toolchain may define variables in different locations.
+ mutable DeclaredArgumentsPerToolchain declared_arguments_per_toolchain_;
Args& operator=(const Args& other); // Disallow assignment.
};
« no previous file with comments | « tools/gn/BUILD.gn ('k') | tools/gn/args.cc » ('j') | tools/gn/args.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698