Minor fixes to tools/gn. Fix incorrect array indexing in EnsureValidSourcesSubstitutions when reporting an invalid substitution usage (the code was using the index in another array to index in kSubstitutionNames). Remove declaration of CopyTargetGenerator::FillDestDir as the method is not implemented. Fix some typos in comments and in the name of IsValidToolSubstitution (was spelled out IsValidToolSubst*u*t*i*tion). BUG=297668 Review URL: https://codereview.chromium.org/1750283003 Cr-Original-Commit-Position: refs/heads/master@{#379256} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: d1d65269209951e2e784682b47087d04e93a44bf
diff --git a/tools/gn/copy_target_generator.h b/tools/gn/copy_target_generator.h index 81fbb69..b05855f 100644 --- a/tools/gn/copy_target_generator.h +++ b/tools/gn/copy_target_generator.h
@@ -21,8 +21,6 @@ void DoRun() override; private: - void FillDestDir(); - DISALLOW_COPY_AND_ASSIGN(CopyTargetGenerator); };
diff --git a/tools/gn/function_toolchain.cc b/tools/gn/function_toolchain.cc index 3e272c9..9eeae98 100644 --- a/tools/gn/function_toolchain.cc +++ b/tools/gn/function_toolchain.cc
@@ -816,8 +816,8 @@ subst_validator = &IsValidCopySubstitution; subst_output_validator = &IsValidCopySubstitution; } else { - subst_validator = &IsValidToolSubstutition; - subst_output_validator = &IsValidToolSubstutition; + subst_validator = &IsValidToolSubstitution; + subst_output_validator = &IsValidToolSubstitution; } scoped_ptr<Tool> tool(new Tool);
diff --git a/tools/gn/substitution_list.h b/tools/gn/substitution_list.h index 7273ece..eaf8a61 100644 --- a/tools/gn/substitution_list.h +++ b/tools/gn/substitution_list.h
@@ -30,7 +30,7 @@ const std::vector<SubstitutionPattern>& list() const { return list_; } - // Returns a list of all substitution types used by the patterns in thist + // Returns a list of all substitution types used by the patterns in this // list, with the exception of LITERAL. const std::vector<SubstitutionType>& required_types() const { return required_types_;
diff --git a/tools/gn/substitution_type.cc b/tools/gn/substitution_type.cc index b92c756..b66e087 100644 --- a/tools/gn/substitution_type.cc +++ b/tools/gn/substitution_type.cc
@@ -127,7 +127,7 @@ type == SUBSTITUTION_SOURCE_OUT_DIR; } -bool IsValidToolSubstutition(SubstitutionType type) { +bool IsValidToolSubstitution(SubstitutionType type) { return type == SUBSTITUTION_LITERAL || type == SUBSTITUTION_OUTPUT || type == SUBSTITUTION_LABEL || @@ -140,7 +140,7 @@ } bool IsValidCompilerSubstitution(SubstitutionType type) { - return IsValidToolSubstutition(type) || + return IsValidToolSubstitution(type) || IsValidSourceSubstitution(type) || type == SUBSTITUTION_SOURCE || type == SUBSTITUTION_ASMFLAGS || @@ -155,12 +155,12 @@ bool IsValidCompilerOutputsSubstitution(SubstitutionType type) { // All tool types except "output" (which would be infinitely recursive). - return (IsValidToolSubstutition(type) && type != SUBSTITUTION_OUTPUT) || + return (IsValidToolSubstitution(type) && type != SUBSTITUTION_OUTPUT) || IsValidSourceSubstitution(type); } bool IsValidLinkerSubstitution(SubstitutionType type) { - return IsValidToolSubstutition(type) || + return IsValidToolSubstitution(type) || type == SUBSTITUTION_LINKER_INPUTS || type == SUBSTITUTION_LINKER_INPUTS_NEWLINE || type == SUBSTITUTION_LDFLAGS || @@ -176,7 +176,7 @@ } bool IsValidCopySubstitution(SubstitutionType type) { - return IsValidToolSubstutition(type) || + return IsValidToolSubstitution(type) || type == SUBSTITUTION_SOURCE; } @@ -187,7 +187,7 @@ for (size_t i = 0; i < types.size(); i++) { if (!IsValidSourceSubstitution(types[i])) { *err = Err(origin, "Invalid substitution type.", - "The substitution " + std::string(kSubstitutionNames[i]) + + "The substitution " + std::string(kSubstitutionNames[types[i]]) + " isn't valid for something\n" "operating on a source file such as this."); return false;
diff --git a/tools/gn/substitution_type.h b/tools/gn/substitution_type.h index dfe9b54..02787b1 100644 --- a/tools/gn/substitution_type.h +++ b/tools/gn/substitution_type.h
@@ -11,7 +11,7 @@ class ParseNode; // Keep kSubstitutionNames, kSubstitutionNinjaNames and the -// IsValid*Substutition functions in sync if you change anything here. +// IsValid*Substitution functions in sync if you change anything here. enum SubstitutionType { SUBSTITUTION_LITERAL = 0, @@ -93,13 +93,13 @@ // Returns true if the given substitution pattern references the output // directory. This is used to check strings that begin with a substitution to -// verify that the produce a file in the output directory. +// verify that they produce a file in the output directory. bool SubstitutionIsInOutputDir(SubstitutionType type); // Returns true if the given substitution is valid for the named purpose. bool IsValidSourceSubstitution(SubstitutionType type); // Both compiler and linker tools. -bool IsValidToolSubstutition(SubstitutionType type); +bool IsValidToolSubstitution(SubstitutionType type); bool IsValidCompilerSubstitution(SubstitutionType type); bool IsValidCompilerOutputsSubstitution(SubstitutionType type); bool IsValidLinkerSubstitution(SubstitutionType type);
diff --git a/tools/gn/substitution_writer.cc b/tools/gn/substitution_writer.cc index 2af2e18..99abced 100644 --- a/tools/gn/substitution_writer.cc +++ b/tools/gn/substitution_writer.cc
@@ -69,7 +69,7 @@ " {{source_name_part}}\n" " The filename part of the source file with no directory or\n" " extension. This will generally be used for specifying a\n" - " transformation from a soruce file to a destination file with the\n" + " transformation from a source file to a destination file with the\n" " same name but different extension.\n" " \"//foo/bar/baz.txt\" => \"baz\"\n" "\n" @@ -174,7 +174,7 @@ for (const auto& pattern : list.list()) { CHECK(pattern.ranges().size() == 1 && pattern.ranges()[0].type == SUBSTITUTION_LITERAL) - << "The substitution patterm \"" + << "The substitution pattern \"" << pattern.AsString() << "\" was expected to be a literal with no {{substitutions}}."; const std::string& literal = pattern.ranges()[0].literal;
diff --git a/tools/gn/substitution_writer.h b/tools/gn/substitution_writer.h index f50fb8d..a450bbb 100644 --- a/tools/gn/substitution_writer.h +++ b/tools/gn/substitution_writer.h
@@ -115,7 +115,7 @@ std::vector<OutputFile>* output); // Like ApplyListToSource but applies the list to all sources and replaces - // rather than appesnds the output (this produces the complete output). + // rather than appends the output (this produces the complete output). static void ApplyListToSources( const Settings* settings, const SubstitutionList& list,
diff --git a/tools/gn/toolchain.h b/tools/gn/toolchain.h index b49153b..bcc70c0 100644 --- a/tools/gn/toolchain.h +++ b/tools/gn/toolchain.h
@@ -99,7 +99,7 @@ // Returns the tool that produces the final output for the given target type. // This isn't necessarily the tool you would expect. For copy target, this - // will return the stamp tool ionstead since the final output of a copy + // will return the stamp tool instead since the final output of a copy // target is to stamp the set of copies done so there is one output. static ToolType GetToolTypeForTargetFinalOutput(const Target* target); const Tool* GetToolForTargetFinalOutput(const Target* target) const;
diff --git a/tools/gn/variables.cc b/tools/gn/variables.cc index c0bf6cb..0242904 100644 --- a/tools/gn/variables.cc +++ b/tools/gn/variables.cc
@@ -824,7 +824,8 @@ "\n" " For action and action_foreach targets, inputs should be the inputs to\n" " script that don't vary. These should be all .py files that the script\n" - " uses via imports (the main script itself will be an implcit dependency\n" + " uses via imports (the main script itself will be an implicit dependency" + "\n" " of the action so need not be listed).\n" "\n" " For action targets, inputs and sources are treated the same, but from\n"