Fix a few typos

I'm trying to set up an autoroller for GN in Chromium. It's currently
stuck in a bad state, and the easiest way to try and get it unstuck
is to have a new upstream GN commit. Apologies.

Change-Id: I6beff0dff7140a88fa5a205961f4dc6a40b7d22a
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/11200
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
diff --git a/src/base/atomic_ref_count.h b/src/base/atomic_ref_count.h
index 3ffa017..7ebef16 100644
--- a/src/base/atomic_ref_count.h
+++ b/src/base/atomic_ref_count.h
@@ -38,7 +38,7 @@
   }
 
   // Return whether the reference count is one.  If the reference count is used
-  // in the conventional way, a refrerence count of 1 implies that the current
+  // in the conventional way, a reference count of 1 implies that the current
   // thread owns the reference and no other thread shares it.  This call
   // performs the test for a reference count of one, and performs the memory
   // barrier needed for the owning thread to act on the object, knowing that it
diff --git a/src/base/command_line.cc b/src/base/command_line.cc
index 93e48cc..ea4bbda 100644
--- a/src/base/command_line.cc
+++ b/src/base/command_line.cc
@@ -107,7 +107,7 @@
 }
 
 #if defined(OS_WIN)
-// Quote a string as necessary for CommandLineToArgvW compatiblity *on Windows*.
+// Quote a string as necessary for CommandLineToArgvW compatibility *on Windows*.
 std::u16string QuoteForCommandLineToArgvW(const std::u16string& arg,
                                           bool quote_placeholders) {
   // We follow the quoting rules of CommandLineToArgvW.
diff --git a/src/base/containers/circular_deque.h b/src/base/containers/circular_deque.h
index bf42a95..2048336 100644
--- a/src/base/containers/circular_deque.h
+++ b/src/base/containers/circular_deque.h
@@ -636,7 +636,7 @@
   void resize(size_type count) {
     // SEE BELOW VERSION if you change this. The code is mostly the same.
     if (count > size()) {
-      // This could be slighly more efficient but expanding a queue with
+      // This could be slightly more efficient but expanding a queue with
       // identical elements is unusual and the extra computations of emplacing
       // one-by-one will typically be small relative to calling the constructor
       // for every item.
@@ -677,7 +677,7 @@
   // The implementation of insert isn't optimized as much as it could be. If
   // the insertion requires that the buffer be grown, it will first be grown
   // and everything moved, and then the items will be inserted, potentially
-  // moving some items twice. This simplifies the implemntation substantially
+  // moving some items twice. This simplifies the implementation substantially
   // and means less generated templatized code. Since this is an uncommon
   // operation for deques, and already relatively slow, it doesn't seem worth
   // the benefit to optimize this.
@@ -1041,7 +1041,7 @@
   }
 
 #if DCHECK_IS_ON()
-  // Asserts the given index is dereferencable. The index is an index into the
+  // Asserts the given index is dereferenceable. The index is an index into the
   // buffer, not an index used by operator[] or at() which will be offsets from
   // begin.
   void CheckValidIndex(size_t i) const {
@@ -1051,7 +1051,7 @@
       DCHECK((i >= begin_ && i < buffer_.capacity()) || i < end_);
   }
 
-  // Asserts the given index is either dereferencable or points to end().
+  // Asserts the given index is either dereferenceable or points to end().
   void CheckValidIndexOrEnd(size_t i) const {
     if (i != end_)
       CheckValidIndex(i);
diff --git a/src/base/files/file.h b/src/base/files/file.h
index dead6bd..b286f69 100644
--- a/src/base/files/file.h
+++ b/src/base/files/file.h
@@ -183,7 +183,7 @@
   // Same as above but without seek.
   int ReadAtCurrentPosNoBestEffort(char* data, int size);
 
-  // Writes the given buffer into the file at the given offset, overwritting any
+  // Writes the given buffer into the file at the given offset, overwriting any
   // data that was previously there. Returns the number of bytes written, or -1
   // on error. Note that this function makes a best effort to write all data on
   // all platforms. |data| can be nullptr when |size| is 0.
diff --git a/src/base/files/file_enumerator.h b/src/base/files/file_enumerator.h
index 81f757b..3a2a823 100644
--- a/src/base/files/file_enumerator.h
+++ b/src/base/files/file_enumerator.h
@@ -47,7 +47,7 @@
     bool IsDirectory() const;
 
     // The name of the file. This will not include any path information. This
-    // is in constrast to the value returned by FileEnumerator.Next() which
+    // is in contrast to the value returned by FileEnumerator.Next() which
     // includes the |root_path| passed into the FileEnumerator constructor.
     FilePath GetName() const;
 
diff --git a/src/base/files/file_path.cc b/src/base/files/file_path.cc
index 4e98653..d59b8ea 100644
--- a/src/base/files/file_path.cc
+++ b/src/base/files/file_path.cc
@@ -267,7 +267,7 @@
 
 #if defined(FILE_PATH_USES_DRIVE_LETTERS)
   // Windows can access case sensitive filesystems, so component
-  // comparisions must be case sensitive, but drive letters are
+  // comparisons must be case sensitive, but drive letters are
   // never case sensitive.
   if ((FindDriveLetter(*parent_comp) != StringType::npos) &&
       (FindDriveLetter(*child_comp) != StringType::npos)) {
diff --git a/src/base/files/file_util_posix.cc b/src/base/files/file_util_posix.cc
index 1eef8e8..7ee1645 100644
--- a/src/base/files/file_util_posix.cc
+++ b/src/base/files/file_util_posix.cc
@@ -446,7 +446,7 @@
   if (real_path_result.empty())
     return false;
 
-  // To be consistant with windows, fail if |real_path_result| is a
+  // To be consistent with windows, fail if |real_path_result| is a
   // directory.
   if (DirectoryExists(real_path_result))
     return false;
diff --git a/src/base/json/json_parser.h b/src/base/json/json_parser.h
index 0ba1d9d..1001080 100644
--- a/src/base/json/json_parser.h
+++ b/src/base/json/json_parser.h
@@ -194,7 +194,7 @@
   // parser is wound to the first character of any of those.
   std::optional<Value> ConsumeLiteral();
 
-  // Helper function that returns true if the byte squence |match| can be
+  // Helper function that returns true if the byte sequence |match| can be
   // consumed at the current parser position. Returns false if there are fewer
   // than |match|-length bytes or if the sequence does not match, and the
   // parser state is unchanged.
diff --git a/src/base/memory/ref_counted.h b/src/base/memory/ref_counted.h
index 8ebdcd6..acfa004 100644
--- a/src/base/memory/ref_counted.h
+++ b/src/base/memory/ref_counted.h
@@ -151,7 +151,7 @@
 //   };
 //
 // You should always make your destructor non-public, to avoid any code deleting
-// the object accidently while there are references to it.
+// the object accidentally while there are references to it.
 //
 //
 // The ref count manipulation to RefCounted is NOT thread safe and has DCHECKs
diff --git a/src/base/numerics/checked_math_impl.h b/src/base/numerics/checked_math_impl.h
index e083389..673f6d6 100644
--- a/src/base/numerics/checked_math_impl.h
+++ b/src/base/numerics/checked_math_impl.h
@@ -466,7 +466,7 @@
 template <typename T>
 class CheckedNumericState<T, NUMERIC_INTEGER> {
  private:
-  // is_valid_ precedes value_ because member intializers in the constructors
+  // is_valid_ precedes value_ because member initializers in the constructors
   // are evaluated in field order, and is_valid_ must be read when initializing
   // value_.
   bool is_valid_;
diff --git a/src/base/numerics/safe_conversions.h b/src/base/numerics/safe_conversions.h
index 71d6e61..35c4089 100644
--- a/src/base/numerics/safe_conversions.h
+++ b/src/base/numerics/safe_conversions.h
@@ -180,7 +180,7 @@
 // saturated_cast<> is analogous to static_cast<> for numeric types, except
 // that the specified numeric conversion will saturate by default rather than
 // overflow or underflow, and NaN assignment to an integral will return 0.
-// All boundary condition behaviors can be overriden with a custom handler.
+// All boundary condition behaviors can be overridden with a custom handler.
 template <typename Dst,
           template <typename> class SaturationHandler = SaturationDefaultLimits,
           typename Src>
diff --git a/src/base/numerics/safe_math_shared_impl.h b/src/base/numerics/safe_math_shared_impl.h
index 8518b45..6fe7b06 100644
--- a/src/base/numerics/safe_math_shared_impl.h
+++ b/src/base/numerics/safe_math_shared_impl.h
@@ -127,7 +127,7 @@
 // Wrap the unary operations to allow SFINAE when instantiating integrals versus
 // floating points. These don't perform any overflow checking. Rather, they
 // exhibit well-defined overflow semantics and rely on the caller to detect
-// if an overflow occured.
+// if an overflow occurred.
 
 template <typename T,
           typename std::enable_if<std::is_integral<T>::value>::type* = nullptr>
diff --git a/src/base/scoped_generic.h b/src/base/scoped_generic.h
index 6a56f64..b1d479d 100644
--- a/src/base/scoped_generic.h
+++ b/src/base/scoped_generic.h
@@ -93,7 +93,7 @@
   }
 
   // Frees the currently owned object, if any. Then takes ownership of a new
-  // object, if given. Self-resets are not allowd as on unique_ptr. See
+  // object, if given. Self-resets are not allowed as on unique_ptr. See
   // http://crbug.com/162971
   void reset(const element_type& value = traits_type::InvalidValue()) {
     if (data_.generic != traits_type::InvalidValue() && data_.generic == value)
diff --git a/src/base/strings/string_util.cc b/src/base/strings/string_util.cc
index ba918ad..52049a8 100644
--- a/src/base/strings/string_util.cc
+++ b/src/base/strings/string_util.cc
@@ -373,7 +373,7 @@
         --chars_written;
       }
     } else {
-      // Non-whitespace chracters are copied straight across.
+      // Non-whitespace characters are copied straight across.
       in_whitespace = false;
       already_trimmed = false;
       result[chars_written++] = *i;
diff --git a/src/base/values.h b/src/base/values.h
index b32c8f9..0b1dde6 100644
--- a/src/base/values.h
+++ b/src/base/values.h
@@ -198,7 +198,7 @@
   // This overload is necessary to avoid ambiguity for const char* arguments.
   Value* SetKey(const char* key, Value value);
 
-  // This attemps to remove the value associated with |key|. In case of failure,
+  // This attempts to remove the value associated with |key|. In case of failure,
   // e.g. the key does not exist, |false| is returned and the underlying
   // dictionary is not changed. In case of success, |key| is deleted from the
   // dictionary and the method returns |true|.
diff --git a/src/base/win/registry.h b/src/base/win/registry.h
index f56d2a2..8e5de46 100644
--- a/src/base/win/registry.h
+++ b/src/base/win/registry.h
@@ -58,7 +58,7 @@
   HKEY Take();
 
   // Returns false if this key does not have the specified value, or if an error
-  // occurrs while attempting to access it.
+  // occurs while attempting to access it.
   bool HasValue(const char16_t* value_name) const;
 
   // Returns the number of values for this key, or 0 if the number cannot be
diff --git a/src/gn/args.cc b/src/gn/args.cc
index d7f8b66..c21beea 100644
--- a/src/gn/args.cc
+++ b/src/gn/args.cc
@@ -396,7 +396,7 @@
   declared_arguments[variables::kTargetCpu] = empty_string;
 
   // Mark these variables used so the build config file can override them
-  // without geting a warning about overwriting an unused variable.
+  // without getting a warning about overwriting an unused variable.
   dest->MarkUsed(variables::kHostCpu);
   dest->MarkUsed(variables::kCurrentCpu);
   dest->MarkUsed(variables::kTargetCpu);
diff --git a/src/gn/builder.cc b/src/gn/builder.cc
index 0634935..d31eaa4 100644
--- a/src/gn/builder.cc
+++ b/src/gn/builder.cc
@@ -23,7 +23,7 @@
 using BuilderRecordSet = BuilderRecord::BuilderRecordSet;
 
 // Recursively looks in the tree for a given node, returning true if it
-// was found in the dependecy graph. This is used to see if a given node
+// was found in the dependency graph. This is used to see if a given node
 // participates in a cycle.
 //
 // If this returns true, the cycle will be in *path. This should point to an
@@ -288,7 +288,7 @@
     record->AddDep(dep_record);
   }
 
-  // The default toolchain gets generated by default. Also propogate the
+  // The default toolchain gets generated by default. Also propagate the
   // generate flag if it depends on items in a non-default toolchain.
   if (record->should_generate() ||
       toolchain->settings()->default_toolchain_label() == toolchain->label())
diff --git a/src/gn/builder.h b/src/gn/builder.h
index 77cdc5e..9f86826 100644
--- a/src/gn/builder.h
+++ b/src/gn/builder.h
@@ -114,7 +114,7 @@
 
   void ScheduleItemLoadIfNecessary(BuilderRecord* record);
 
-  // This takes a BuilderRecord with resolved depdencies, and fills in the
+  // This takes a BuilderRecord with resolved dependencies, and fills in the
   // target's Label*Vectors with the resolved pointers.
   bool ResolveItem(BuilderRecord* record, Err* err);
 
diff --git a/src/gn/command_args.cc b/src/gn/command_args.cc
index 2689f88..14ca348 100644
--- a/src/gn/command_args.cc
+++ b/src/gn/command_args.cc
@@ -171,7 +171,7 @@
   // Fetch argument name.
   dict.SetKey("name", base::Value(name));
 
-  // Fetch overridden value inforrmation (if present).
+  // Fetch overridden value information (if present).
   if (arg.has_override) {
     base::DictionaryValue override_dict;
     override_dict.SetKey("value",
diff --git a/src/gn/command_clean.cc b/src/gn/command_clean.cc
index 4f2548c..5290dd6 100644
--- a/src/gn/command_clean.cc
+++ b/src/gn/command_clean.cc
@@ -96,7 +96,7 @@
     return false;
   }
 
-  // Write a .d file for the build which references a nonexistant file.
+  // Write a .d file for the build which references a nonexistent file.
   // This will make Ninja always mark the build as dirty.
   std::string dummy_content("build.ninja: nonexistant_file.gn\n");
   if (base::WriteFile(build_ninja_d_file, dummy_content.data(),
diff --git a/src/gn/command_path.cc b/src/gn/command_path.cc
index 9ea7f72..a82c90d 100644
--- a/src/gn/command_path.cc
+++ b/src/gn/command_path.cc
@@ -137,7 +137,7 @@
   // Don't try to insert the 0th item in the list which is the "from" target.
   // The search will be run more than once (for the different path types) and
   // if the "from" target was in the list, subsequent passes could never run
-  // the starting point is alredy in the list of targets considered).
+  // the starting point is already in the list of targets considered).
   //
   // One might imagine an alternate implementation where all items are counted
   // here but the "from" item is erased at the beginning of each search, but
diff --git a/src/gn/compile_commands_writer.h b/src/gn/compile_commands_writer.h
index be4e90b..adc2986 100644
--- a/src/gn/compile_commands_writer.h
+++ b/src/gn/compile_commands_writer.h
@@ -35,7 +35,7 @@
       const std::set<std::string>& target_filters_set);
 
  private:
-  // This fuction visits the deps graph of a target in a DFS fashion.
+  // This function visits the deps graph of a target in a DFS fashion.
   static void VisitDeps(const Target* target, std::set<const Target*>* visited);
 };
 
diff --git a/src/gn/desc_builder.cc b/src/gn/desc_builder.cc
index 9dd9d5f..bbbf831 100644
--- a/src/gn/desc_builder.cc
+++ b/src/gn/desc_builder.cc
@@ -24,7 +24,7 @@
 #include "gn/variables.h"
 
 // Example structure of Value for single target
-// (not applicable or empty fields will be ommitted depending on target type)
+// (not applicable or empty fields will be omitted depending on target type)
 //
 // target_properties = {
 //   "type" : "output_type", // matching Target::GetStringForOutputType
@@ -37,7 +37,7 @@
 //   "public" : either "*" or [ list of public headers],
 //   "inputs" : [ list of inputs for target ],
 //   "configs" : [ list of configs for this target ],
-//   "public_configs" : [ list of public configs for this taget],
+//   "public_configs" : [ list of public configs for this target],
 //   "all_dependent_configs", [ list of all dependent configs for this target],
 //   "script" : "script for action targets",
 //   "args" : [ argument list for action targets ],
diff --git a/src/gn/exec_process.cc b/src/gn/exec_process.cc
index 2f001bf..cc778d8 100644
--- a/src/gn/exec_process.cc
+++ b/src/gn/exec_process.cc
@@ -231,7 +231,7 @@
       fd_shuffle1.push_back(
           base::InjectionArc(err_write.get(), STDERR_FILENO, true));
       fd_shuffle1.push_back(base::InjectionArc(dev_null, STDIN_FILENO, true));
-      // Adding another element here? Remeber to increase the argument to
+      // Adding another element here? Remember to increase the argument to
       // reserve(), above.
 
       // DANGER: Do NOT convert to range-based for loop!
diff --git a/src/gn/filesystem_utils.cc b/src/gn/filesystem_utils.cc
index ae6d4d9..9eb713b 100644
--- a/src/gn/filesystem_utils.cc
+++ b/src/gn/filesystem_utils.cc
@@ -589,7 +589,7 @@
 
                 // |path| is now absolute, so |top_index| is 1. |dest_i| and
                 // |src_i| should be incremented to keep the same relative
-                // position. Comsume the leading "//" by decrementing |dest_i|.
+                // position. Consume the leading "//" by decrementing |dest_i|.
                 top_index = 1;
                 pathbuf = &(*path)[0];
                 dest_i += source_root_len - 2;
@@ -610,7 +610,7 @@
             src_i += consumed_len;
         }
       } else {
-        // Dot not preceeded by a slash, copy it literally.
+        // Dot not preceded by a slash, copy it literally.
         pathbuf[dest_i++] = pathbuf[src_i++];
       }
     } else if (IsSlash(pathbuf[src_i])) {
@@ -618,7 +618,7 @@
         // Two slashes in a row, skip over it.
         src_i++;
       } else {
-        // Just one slash, copy it, normalizing to foward slash.
+        // Just one slash, copy it, normalizing to forward slash.
         pathbuf[dest_i] = '/';
         dest_i++;
         src_i++;
@@ -838,7 +838,7 @@
 
   // With no source_root, there's nothing we can do about
   // e.g. input=../../../path/to/file and value=//source and we'll
-  // errornously return //file.
+  // erroneously return //file.
   result.reserve(value.size() + input.size());
   result.assign(value);
   result.append(input.data(), input.size());
diff --git a/src/gn/functions.h b/src/gn/functions.h
index e0af413..890dcc7 100644
--- a/src/gn/functions.h
+++ b/src/gn/functions.h
@@ -547,7 +547,7 @@
   const char* type_description_;
 
   // Set to true when the key is added to the scope so we don't try to
-  // delete nonexistant keys which will cause assertions.
+  // delete nonexistent keys which will cause assertions.
   bool key_added_;
 };
 
diff --git a/src/gn/generated_file_target_generator.cc b/src/gn/generated_file_target_generator.cc
index 16ac639..2506f19 100644
--- a/src/gn/generated_file_target_generator.cc
+++ b/src/gn/generated_file_target_generator.cc
@@ -75,7 +75,7 @@
         Err(origin, std::string(variable) + " won't be used.",
             "\"contents\" is defined on this target, and so setting " +
                 std::string(variable) +
-                " will have no effect as no metdata collection will occur.");
+                " will have no effect as no metadata collection will occur.");
     return false;
   }
   return true;
diff --git a/src/gn/hash_table_base.h b/src/gn/hash_table_base.h
index 22fcaea..c26b514 100644
--- a/src/gn/hash_table_base.h
+++ b/src/gn/hash_table_base.h
@@ -73,7 +73,7 @@
 //
 // Lookup, insertion and deletion are performed in ways that
 // are *very* different from standard containers, and the reason
-// is, unsuprisingly, performance.
+// is, unsurprisingly, performance.
 //
 // Use NodeLookup() to look for an existing item in the hash table.
 // This takes the item's hash value, and a templated callable to
@@ -137,7 +137,7 @@
 //      }
 //
 //      // Try to add |key| to the set. Return true if the insertion
-//      // was succesful, or false if the item was already in the set.
+//      // was successful, or false if the item was already in the set.
 //      bool add(const Foo& key) {
 //        size_t hash = MakeHash(key);
 //        Node* node = NodeLookup(
@@ -433,7 +433,7 @@
   }
 
   // Call this method after updating the content of the |node| pointer
-  // returned by an unsucessful NodeLookup(). Return true to indicate that
+  // returned by an unsuccessful NodeLookup(). Return true to indicate that
   // the table size changed, and that existing iterators were invalidated.
   bool UpdateAfterInsert() {
     count_ += 1;
@@ -445,7 +445,7 @@
   }
 
   // Call this method after updating the content of the |node| value
-  // returned a by succesful NodeLookup, to the tombstone value, if any.
+  // returned a by successful NodeLookup, to the tombstone value, if any.
   // Return true to indicate a table size change, ie. that existing
   // iterators where invalidated.
   bool UpdateAfterRemoval() {
diff --git a/src/gn/hash_table_base_unittest.cc b/src/gn/hash_table_base_unittest.cc
index a4c3244..d6324cf 100644
--- a/src/gn/hash_table_base_unittest.cc
+++ b/src/gn/hash_table_base_unittest.cc
@@ -96,7 +96,7 @@
   // IMPORTANT NOTE: Because the table contains bare owning pointers, we
   // have to use explicit copy and move constructor/operators for things
   // to work as expected. This is yet another reason why HashTableBase<>
-  // should only be used with care (preferrably with non-owning pointers).
+  // should only be used with care (preferably with non-owning pointers).
   //
   TestHashTable(const TestHashTable& other) : BaseType(other) {
     // Only node (i.e. pointers) are copied by the base type.
diff --git a/src/gn/inherited_libraries.cc b/src/gn/inherited_libraries.cc
index 87974ae..37e0b97 100644
--- a/src/gn/inherited_libraries.cc
+++ b/src/gn/inherited_libraries.cc
@@ -59,7 +59,7 @@
 void InheritedLibraries::AppendInherited(const InheritedLibraries& other,
                                          bool is_public) {
   // Append all items in order, mark them public only if the're already public
-  // and we're adding them publically.
+  // and we're adding them publicly.
   for (const auto& cur : other.GetOrderedAndPublicFlag())
     Append(cur.first, is_public && cur.second);
 }
diff --git a/src/gn/inherited_libraries.h b/src/gn/inherited_libraries.h
index 71d02f4..f56c648 100644
--- a/src/gn/inherited_libraries.h
+++ b/src/gn/inherited_libraries.h
@@ -41,7 +41,7 @@
   // Appends all items from the "other" list to the current one. The is_public
   // parameter indicates how the current target depends on the items in
   // "other". If is_public is true, the existing public flags of the appended
-  // items will be preserved (propogating the public-ness up the dependency
+  // items will be preserved (propagating the public-ness up the dependency
   // chain). If is_public is false, all deps will be added as private since
   // the current target isn't forwarding them.
   void AppendInherited(const InheritedLibraries& other, bool is_public);
diff --git a/src/gn/input_file_manager.cc b/src/gn/input_file_manager.cc
index 7e0d7ee..4ecb80b 100644
--- a/src/gn/input_file_manager.cc
+++ b/src/gn/input_file_manager.cc
@@ -293,7 +293,7 @@
   bool success =
       DoLoadFile(origin, build_settings, name, load_file_callback_, file, &tokens, &root, err);
   // Can't return early. We have to ensure that the completion event is
-  // signaled in all cases bacause another thread could be blocked on this one.
+  // signaled in all cases because another thread could be blocked on this one.
 
   // Save this pointer for running the callbacks below, which happens after the
   // scoped ptr ownership is taken away inside the lock.
diff --git a/src/gn/input_file_manager.h b/src/gn/input_file_manager.h
index d5e5553..d495bee 100644
--- a/src/gn/input_file_manager.h
+++ b/src/gn/input_file_manager.h
@@ -37,7 +37,7 @@
 // various state points into them.
 class InputFileManager : public base::RefCountedThreadSafe<InputFileManager> {
  public:
-  // Callback issued when a file is laoded. On auccess, the parse node will
+  // Callback issued when a file is loaded. On auccess, the parse node will
   // refer to the root block of the file. On failure, this will be NULL.
   using FileLoadCallback = std::function<void(const ParseNode*)>;
 
diff --git a/src/gn/label_ptr.h b/src/gn/label_ptr.h
index fd4d5c0..cf30772 100644
--- a/src/gn/label_ptr.h
+++ b/src/gn/label_ptr.h
@@ -28,7 +28,7 @@
 
   explicit LabelPtrPair(const Label& l) : label(l) {}
 
-  // This contructor is typically used in unit tests, it extracts the label
+  // This constructor is typically used in unit tests, it extracts the label
   // automatically from a given pointer.
   explicit LabelPtrPair(const T* p) : label(p->label()), ptr(p) {}
 
diff --git a/src/gn/label_unittest.cc b/src/gn/label_unittest.cc
index 8882019..159bba8 100644
--- a/src/gn/label_unittest.cc
+++ b/src/gn/label_unittest.cc
@@ -121,7 +121,7 @@
   EXPECT_EQ("/foo/", result.dir().value()) << result.dir().value();
   EXPECT_EQ("target", result.name());
 
-  // It should't go up higher than the system root.
+  // It shouldn't go up higher than the system root.
   result = Label::Resolve(cur_dir, source_root, default_toolchain,
                           Value(nullptr, "../../../../..:target"), &err);
   EXPECT_FALSE(err.has_error());
diff --git a/src/gn/metadata.h b/src/gn/metadata.h
index d8298e8..c0a0042 100644
--- a/src/gn/metadata.h
+++ b/src/gn/metadata.h
@@ -36,7 +36,7 @@
   const ParseNode* origin() const { return origin_; }
   void set_origin(const ParseNode* origin) { origin_ = origin; }
 
-  // The contents of this metadata varaiable.
+  // The contents of this metadata variable.
   const Contents& contents() const { return contents_; }
   Contents& contents() { return contents_; }
   void set_contents(Contents&& contents) { contents_ = std::move(contents); }
diff --git a/src/gn/ninja_build_writer.cc b/src/gn/ninja_build_writer.cc
index 04e0754..e7852aa 100644
--- a/src/gn/ninja_build_writer.cc
+++ b/src/gn/ninja_build_writer.cc
@@ -528,7 +528,7 @@
     // If at this point there is a collision (no phony rules have been
     // generated yet), two targets make the same output so throw an error.
     for (const auto& output : target->computed_outputs()) {
-      // Need to normalize because many toolchain outputs will be preceeded
+      // Need to normalize because many toolchain outputs will be preceded
       // with "./".
       std::string output_string(output.value());
       NormalizePath(&output_string);
diff --git a/src/gn/ninja_c_binary_target_writer.h b/src/gn/ninja_c_binary_target_writer.h
index bbc71c5..da75178 100644
--- a/src/gn/ninja_c_binary_target_writer.h
+++ b/src/gn/ninja_c_binary_target_writer.h
@@ -96,7 +96,7 @@
   // the "||" and everything following it on the ninja line.
   //
   // The order-only dependencies are the non-linkable deps passed in as an
-  // argument, plus the data file depdencies in the target.
+  // argument, plus the data file dependencies in the target.
   void WriteOrderOnlyDependencies(
       const UniqueVector<const Target*>& non_linkable_deps);
 
diff --git a/src/gn/ninja_c_binary_target_writer_unittest.cc b/src/gn/ninja_c_binary_target_writer_unittest.cc
index 99961da..35d9841 100644
--- a/src/gn/ninja_c_binary_target_writer_unittest.cc
+++ b/src/gn/ninja_c_binary_target_writer_unittest.cc
@@ -365,7 +365,7 @@
       SubstitutionList::MakeForTest("//out/Debug/generated.cc");
   ASSERT_TRUE(action.OnResolved(&err));
 
-  // A source set compiling geneated code, this target does not publicize any
+  // A source set compiling generated code, this target does not publicize any
   // headers.
   Target gen_obj(setup.settings(), Label(SourceDir("//foo/"), "gen_obj"));
   gen_obj.set_output_type(Target::SOURCE_SET);
diff --git a/src/gn/ninja_target_writer.cc b/src/gn/ninja_target_writer.cc
index 7eefc12..421c575 100644
--- a/src/gn/ninja_target_writer.cc
+++ b/src/gn/ninja_target_writer.cc
@@ -206,7 +206,7 @@
     input_deps_sources.push_back(&target_->action_values().script());
 
   // Input files are only considered for non-binary targets which use an
-  // implicit dependency instead. The implicit depedency in this case is
+  // implicit dependency instead. The implicit dependency in this case is
   // handled separately by the binary target writer.
   if (!target_->IsBinary()) {
     for (ConfigValuesIterator iter(target_); !iter.done(); iter.Next()) {
diff --git a/src/gn/runtime_deps_unittest.cc b/src/gn/runtime_deps_unittest.cc
index e79d749..baa14e4 100644
--- a/src/gn/runtime_deps_unittest.cc
+++ b/src/gn/runtime_deps_unittest.cc
@@ -380,7 +380,7 @@
 
   // The rest of the ordering is undefined.
 
-  // The framework bundle's internal dependencies should not be incldued.
+  // The framework bundle's internal dependencies should not be included.
   EXPECT_TRUE(
       base::ContainsValue(result, MakePair("Bundle.framework/", &bundle)))
       << GetVectorDescription(result);
diff --git a/src/gn/rust_project_writer.cc b/src/gn/rust_project_writer.cc
index 9134cd0..117442f 100644
--- a/src/gn/rust_project_writer.cc
+++ b/src/gn/rust_project_writer.cc
@@ -174,7 +174,7 @@
                                            "unwind"};
 
 // Multiple sysroot crates have dependenices on each other.  This provides a
-// mechanism for specifiying that in an extendible manner.
+// mechanism for specifying that in an extendible manner.
 const std::unordered_map<std::string_view, std::vector<std::string_view>>
     sysroot_deps_map = {{"alloc", {"core"}},
                         {"std", {"alloc", "core", "panic_abort", "unwind"}}};
diff --git a/src/gn/rust_project_writer.h b/src/gn/rust_project_writer.h
index 8140e06..5c5d453 100644
--- a/src/gn/rust_project_writer.h
+++ b/src/gn/rust_project_writer.h
@@ -12,7 +12,7 @@
 class BuildSettings;
 
 // rust-project.json is an output format describing the rust build graph. It is
-// used by rust-analyzer (a LSP server), similiar to compile-commands.json.
+// used by rust-analyzer (a LSP server), similar to compile-commands.json.
 //
 // an example output is in rust_project_writer.cc
 class RustProjectWriter {
@@ -30,7 +30,7 @@
                          std::ostream& rust_project);
 
  private:
-  // This fuction visits the deps graph of a target in a DFS fashion.
+  // This function visits the deps graph of a target in a DFS fashion.
   static void VisitDeps(const Target* target, std::set<const Target*>* visited);
 };
 
diff --git a/src/gn/scheduler.h b/src/gn/scheduler.h
index 4ea4c02..6fd25fd 100644
--- a/src/gn/scheduler.h
+++ b/src/gn/scheduler.h
@@ -56,7 +56,7 @@
   //
   // TODO(brettw) this is global rather than per-BuildSettings. If we
   // start using >1 build settings, then we probably want this to take a
-  // BuildSettings object so we know the depdency on a per-build basis.
+  // BuildSettings object so we know the dependency on a per-build basis.
   // If moved, most of the Add/Get functions below should move as well.
   void AddGenDependency(const base::FilePath& file);
   std::vector<base::FilePath> GetGenDependencies() const;
diff --git a/src/gn/scope.cc b/src/gn/scope.cc
index a1cf179..7e92766 100644
--- a/src/gn/scope.cc
+++ b/src/gn/scope.cc
@@ -417,7 +417,7 @@
     dest->templates_[current_name] = pair.second;
   }
 
-  // Propogate build dependency files,
+  // Propagate build dependency files,
   dest->AddBuildDependencyFiles(build_dependency_files_);
 
   return true;
diff --git a/src/gn/scope.h b/src/gn/scope.h
index 4621db5..e6a2f5f 100644
--- a/src/gn/scope.h
+++ b/src/gn/scope.h
@@ -28,7 +28,7 @@
 // Scope for the script execution.
 //
 // Scopes are nested. Writing goes into the toplevel scope, reading checks
-// values resursively down the stack until a match is found or there are no
+// values recursively down the stack until a match is found or there are no
 // more containing scopes.
 //
 // A containing scope can be const or non-const. The const containing scope is
@@ -174,7 +174,7 @@
   // different underlying buffer. This is useful because this std::string_view
   // is static and won't be deleted for the life of the program, so it can be
   // used as keys in places that may outlive a temporary. It will return an
-  // empty string for programmatic and nonexistant values.
+  // empty string for programmatic and nonexistent values.
   std::string_view GetStorageKey(const std::string_view& ident) const;
 
   // The set_node indicates the statement that caused the set, for displaying
@@ -280,7 +280,7 @@
   void set_source_dir(const SourceDir& d) { source_dir_ = d; }
 
   // Set of files that may affect the execution of this scope. Note that this
-  // set is constructed conservatively, meanining that every file that can
+  // set is constructed conservatively, meaning that every file that can
   // potentially affect this scope is included, but not necessarily every change
   // to these files will affect this scope.
   const SourceFileSet& build_dependency_files() const {
diff --git a/src/gn/settings.h b/src/gn/settings.h
index 1ae3d38..755513a 100644
--- a/src/gn/settings.h
+++ b/src/gn/settings.h
@@ -96,7 +96,7 @@
   mutable ImportManager import_manager_;
 
   // The subdirectory inside the build output for this toolchain. For the
-  // default toolchain, this will be empty (since the deafult toolchain's
+  // default toolchain, this will be empty (since the default toolchain's
   // output directory is the same as the build directory). When nonempty, this
   // is guaranteed to end in a slash.
   OutputFile toolchain_output_subdir_;
diff --git a/src/gn/string_utils_unittest.cc b/src/gn/string_utils_unittest.cc
index 64fd0c2..ac412d9 100644
--- a/src/gn/string_utils_unittest.cc
+++ b/src/gn/string_utils_unittest.cc
@@ -83,7 +83,7 @@
   EXPECT_TRUE(CheckExpansionCase("hello #$%", nullptr, false));
   EXPECT_TRUE(CheckExpansionCase("hello #${", nullptr, false));
   EXPECT_TRUE(CheckExpansionCase("hello #${}", nullptr, false));
-  EXPECT_TRUE(CheckExpansionCase("hello #$nonexistant", nullptr, false));
+  EXPECT_TRUE(CheckExpansionCase("hello #$nonexistent", nullptr, false));
   EXPECT_TRUE(CheckExpansionCase("hello #${unterminated", nullptr, false));
   EXPECT_TRUE(CheckExpansionCase("hex truncated: $0", nullptr, false));
   EXPECT_TRUE(CheckExpansionCase("hex truncated: $0x", nullptr, false));
diff --git a/src/gn/substitution_pattern.cc b/src/gn/substitution_pattern.cc
index a25d631..8465903 100644
--- a/src/gn/substitution_pattern.cc
+++ b/src/gn/substitution_pattern.cc
@@ -67,7 +67,7 @@
       }
     }
 
-    // Expect all occurrances of {{ to resolve to a pattern.
+    // Expect all occurrences of {{ to resolve to a pattern.
     if (!found_match) {
       // Could make this error message more friendly if it comes up a lot. But
       // most people will not be writing substitution patterns and the code
diff --git a/src/gn/target.cc b/src/gn/target.cc
index dd71abb..cee2ed2 100644
--- a/src/gn/target.cc
+++ b/src/gn/target.cc
@@ -682,14 +682,14 @@
     //
     // In this case:
     //   EXE -> INTERMEDIATE_SHLIB --[public]--> FINAL_SHLIB
-    // The EXE will also link to to FINAL_SHLIB. The public dependeny means
+    // The EXE will also link to to FINAL_SHLIB. The public dependency means
     // that the EXE can use the headers in FINAL_SHLIB so the FINAL_SHLIB
     // will need to appear on EXE's link line.
     //
     // However, if the dependency is private:
     //   EXE -> INTERMEDIATE_SHLIB --[private]--> FINAL_SHLIB
     // the dependency will not be propagated because INTERMEDIATE_SHLIB is
-    // not granting permission to call functiosn from FINAL_SHLIB. If EXE
+    // not granting permission to call functions from FINAL_SHLIB. If EXE
     // wants to use functions (and link to) FINAL_SHLIB, it will need to do
     // so explicitly.
     //
@@ -699,7 +699,7 @@
     inherited_libraries_.AppendPublicSharedLibraries(dep->inherited_libraries(),
                                                      is_public);
   } else if (!dep->IsFinal()) {
-    // The current target isn't linked, so propogate linked deps and
+    // The current target isn't linked, so propagate linked deps and
     // libraries up the dependency tree.
     inherited_libraries_.AppendInherited(dep->inherited_libraries(), is_public);
     rust_values().transitive_libs().AppendInherited(
diff --git a/src/gn/target.h b/src/gn/target.h
index 03f456c..15fb635 100644
--- a/src/gn/target.h
+++ b/src/gn/target.h
@@ -79,16 +79,16 @@
   OutputType output_type() const { return output_type_; }
   void set_output_type(OutputType t) { output_type_ = t; }
 
-  // True for targets that compile source code (all types of libaries and
+  // True for targets that compile source code (all types of libraries and
   // executables).
   bool IsBinary() const;
 
   // Can be linked into other targets.
   bool IsLinkable() const;
 
-  // True if the target links dependencies rather than propogated up the graph.
+  // True if the target links dependencies rather than propagated up the graph.
   // This is also true of action and copy steps even though they don't link
-  // dependencies, because they also don't propogate libraries up.
+  // dependencies, because they also don't propagate libraries up.
   bool IsFinal() const;
 
   // Set when the target should normally be treated as a data dependency. These
diff --git a/src/gn/template.cc b/src/gn/template.cc
index d5b2ecd..f0eca28 100644
--- a/src/gn/template.cc
+++ b/src/gn/template.cc
@@ -64,7 +64,7 @@
   Scope template_scope(closure_.get());
   template_scope.set_source_dir(scope->GetSourceDir());
 
-  // Propogate build dependency files from invoker scope (template scope already
+  // Propagate build dependency files from invoker scope (template scope already
   // propagated via parent scope).
   template_scope.AddBuildDependencyFiles(
       invocation_scope->build_dependency_files());
diff --git a/src/gn/tool.cc b/src/gn/tool.cc
index 5e4186d..18f2036 100644
--- a/src/gn/tool.cc
+++ b/src/gn/tool.cc
@@ -342,7 +342,7 @@
 
 // static
 const char* Tool::GetToolTypeForTargetFinalOutput(const Target* target) {
-  // The contents of this list might be suprising (i.e. stamp tool for copy
+  // The contents of this list might be surprising (i.e. stamp tool for copy
   // rules). See the header for why.
   // TODO(crbug.com/gn/39): Don't emit stamp files for single-output targets.
   if (target->source_types_used().RustSourceUsed()) {
diff --git a/src/gn/xml_element_writer.h b/src/gn/xml_element_writer.h
index b276052..9040d16 100644
--- a/src/gn/xml_element_writer.h
+++ b/src/gn/xml_element_writer.h
@@ -42,7 +42,7 @@
                    const XmlAttributes& attributes,
                    int indent);
   // Starts new XML element with specified indentation. Specialized constructor
-  // that allows writting XML element with single attribute without copying
+  // that allows writing XML element with single attribute without copying
   // attribute value.
   template <class Writer>
   XmlElementWriter(std::ostream& out,