diff --git a/validator/cpp/engine/validator-internal.cc b/validator/cpp/engine/validator-internal.cc index 21058500c2844..63856a5eb540d 100644 --- a/validator/cpp/engine/validator-internal.cc +++ b/validator/cpp/engine/validator-internal.cc @@ -644,9 +644,9 @@ struct ParsedReferencePoint { class ParsedReferencePoints { public: ParsedReferencePoints() : parent_(nullptr) {} - ParsedReferencePoints( - const TagSpec& parent, - const unordered_map& tag_spec_ids_by_tag_spec_name) + ParsedReferencePoints(const TagSpec& parent, + const absl::flat_hash_map& + tag_spec_ids_by_tag_spec_name) : parent_(&parent) { for (const ReferencePoint& p : parent.reference_points()) { auto iter = tag_spec_ids_by_tag_spec_name.find(p.tag_spec_name()); @@ -1041,11 +1041,11 @@ RecordValidated ShouldRecordTagspecValidated( // which is unique within its context, the ParsedValidatorRules. class ParsedTagSpec { public: - ParsedTagSpec( - ParsedAttrSpecs* parsed_attr_specs, - const unordered_map& tag_spec_ids_by_tag_spec_name, - RecordValidated should_record_tagspec_validated, const TagSpec* spec, - int32_t id) + ParsedTagSpec(ParsedAttrSpecs* parsed_attr_specs, + const absl::flat_hash_map& + tag_spec_ids_by_tag_spec_name, + RecordValidated should_record_tagspec_validated, + const TagSpec* spec, int32_t id) : spec_(spec), id_(id), reference_points_(*spec, tag_spec_ids_by_tag_spec_name), @@ -1218,7 +1218,7 @@ class ParsedTagSpec { const set& implicit_attrspecs() const { return implicit_attrspecs_; } - const unordered_map& attr_ids_by_name() const { + const absl::flat_hash_map& attr_ids_by_name() const { return attr_ids_by_name_; } @@ -1240,7 +1240,7 @@ class ParsedTagSpec { bool is_reference_point_; bool is_type_json_ = false; bool contains_url_ = false; - unordered_map attr_ids_by_name_; + absl::flat_hash_map attr_ids_by_name_; vector disabled_by_; vector enabled_by_; vector mandatory_attr_ids_; @@ -2476,7 +2476,7 @@ class Context { if (!tag_result.best_match_tag_spec) return; const ParsedTagSpec* parsed_tag_spec = tag_result.best_match_tag_spec; if (!parsed_tag_spec->AttrsCanSatisfyExtension()) return; - const unordered_map& attr_ids_by_name = + const absl::flat_hash_map& attr_ids_by_name = parsed_tag_spec->attr_ids_by_name(); ExtensionsContext* extensions_ctx = mutable_extensions(); for (const ParsedHtmlTagAttr& attr : encountered_tag.Attributes()) { @@ -4412,7 +4412,7 @@ void ValidateAttributes(const ParsedTagSpec& parsed_tag_spec, set mandatory_anyofs_seen; vector parsed_trigger_specs; set attrspecs_validated; - const unordered_map& attr_ids_by_name = + const absl::flat_hash_map& attr_ids_by_name = parsed_tag_spec.attr_ids_by_name(); for (const ParsedHtmlTagAttr& attr : encountered_tag.Attributes()) { @@ -4717,7 +4717,7 @@ ParsedValidatorRules::ParsedValidatorRules(HtmlFormat::Code html_format) // |tag_spec_names_to_track| to identify those tagspecs that are // referenced by others via "also_requires_tag". The ParsedTagSpec // constructor completes this translation to ids. - unordered_map tag_spec_ids_by_tag_spec_name; + absl::flat_hash_map tag_spec_ids_by_tag_spec_name; unordered_set tag_spec_names_to_track; for (int ii = 0; ii < rules_.tags_size(); ++ii) { const TagSpec& tag = rules_.tags(ii);