diff --git a/common/find.h b/common/find.h index d551cf1fab34..156c0317f394 100644 --- a/common/find.h +++ b/common/find.h @@ -15,11 +15,11 @@ namespace Carbon { namespace Internal { template -using RangePointerType = typename std::iterator_traits()))>::pointer; +using RangePointerType = + std::iterator_traits()))>::pointer; template -using RangeValueType = typename std::iterator_traits()))>::value_type; template diff --git a/common/hashing_test.cpp b/common/hashing_test.cpp index aff99b873e85..cee95b29140d 100644 --- a/common/hashing_test.cpp +++ b/common/hashing_test.cpp @@ -736,8 +736,8 @@ struct SparseHashTestParamRanges { template struct SparseHashTest : ::testing::Test { - using ByteCount = typename ParamRanges::ByteCount; - using SetBitCount = typename ParamRanges::SetBitCount; + using ByteCount = ParamRanges::ByteCount; + using SetBitCount = ParamRanges::SetBitCount; static auto GetHashedByteStrings() { llvm::SmallVector hashes; diff --git a/common/map.h b/common/map.h index d4b59fb4efd5..5b5d4b0c23b6 100644 --- a/common/map.h +++ b/common/map.h @@ -61,13 +61,13 @@ class MapView : RawHashtable::ViewImpl { using ImplT = RawHashtable::ViewImpl; - using EntryT = typename ImplT::EntryT; + using EntryT = ImplT::EntryT; public: - using KeyT = typename ImplT::KeyT; - using ValueT = typename ImplT::ValueT; - using KeyContextT = typename ImplT::KeyContextT; - using MetricsT = typename ImplT::MetricsT; + using KeyT = ImplT::KeyT; + using ValueT = ImplT::ValueT; + using KeyContextT = ImplT::KeyContextT; + using MetricsT = ImplT::MetricsT; // This type represents the result of lookup operations. It encodes whether // the lookup was a success as well as accessors for the key and value. @@ -160,15 +160,15 @@ class MapBase : protected RawHashtable::BaseImpl; - using EntryT = typename ImplT::EntryT; + using EntryT = ImplT::EntryT; public: - using KeyT = typename ImplT::KeyT; - using ValueT = typename ImplT::ValueT; - using KeyContextT = typename ImplT::KeyContextT; + using KeyT = ImplT::KeyT; + using ValueT = ImplT::ValueT; + using KeyContextT = ImplT::KeyContextT; using ViewT = MapView; - using LookupKVResult = typename ViewT::LookupKVResult; - using MetricsT = typename ImplT::MetricsT; + using LookupKVResult = ViewT::LookupKVResult; + using MetricsT = ImplT::MetricsT; // The result type for insertion operations both indicates whether an insert // was needed (as opposed to finding an existing element), and provides access @@ -385,8 +385,8 @@ class Map : public RawHashtable::TableImpl< using ImplT = RawHashtable::TableImpl; public: - using KeyT = typename BaseT::KeyT; - using ValueT = typename BaseT::ValueT; + using KeyT = BaseT::KeyT; + using ValueT = BaseT::ValueT; Map() = default; Map(const Map& arg) = default; diff --git a/common/map_benchmark.cpp b/common/map_benchmark.cpp index f25d5e362ec9..1ece6d8405fe 100644 --- a/common/map_benchmark.cpp +++ b/common/map_benchmark.cpp @@ -66,8 +66,8 @@ static constexpr bool IsCarbonMap = template struct MapWrapperImpl { using MapT = InMapT; - using KeyT = typename MapT::key_type; - using ValueT = typename MapT::mapped_type; + using KeyT = MapT::key_type; + using ValueT = MapT::mapped_type; MapT m; @@ -218,8 +218,8 @@ auto ReportMetrics(const MapWrapper& m_wrapper, benchmark::State& state) template static void BM_MapContainsHit(benchmark::State& state) { using MapWrapperT = MapWrapper; - using KT = typename MapWrapperT::KeyT; - using VT = typename MapWrapperT::ValueT; + using KT = MapWrapperT::KeyT; + using VT = MapWrapperT::ValueT; MapWrapperT m; auto [keys, lookup_keys] = GetKeysAndHitKeys(state.range(0), state.range(1)); @@ -254,8 +254,8 @@ MAP_BENCHMARK_ONE_OP(BM_MapContainsHit, HitArgs); template static void BM_MapContainsMiss(benchmark::State& state) { using MapWrapperT = MapWrapper; - using KT = typename MapWrapperT::KeyT; - using VT = typename MapWrapperT::ValueT; + using KT = MapWrapperT::KeyT; + using VT = MapWrapperT::ValueT; MapWrapperT m; auto [keys, lookup_keys] = GetKeysAndMissKeys(state.range(0)); for (auto k : keys) { @@ -307,8 +307,8 @@ MAP_BENCHMARK_ONE_OP(BM_MapContainsMiss, SizeArgs); template static void BM_MapLookupHit(benchmark::State& state) { using MapWrapperT = MapWrapper; - using KT = typename MapWrapperT::KeyT; - using VT = typename MapWrapperT::ValueT; + using KT = MapWrapperT::KeyT; + using VT = MapWrapperT::ValueT; MapWrapperT m; auto [keys, lookup_keys] = GetKeysAndHitKeys(state.range(0), state.range(1)); @@ -363,8 +363,8 @@ MAP_BENCHMARK_ONE_OP_SIZE(BM_MapLookupHit, HitArgs, LowZeroBitInt<32>, int); template static void BM_MapUpdateHit(benchmark::State& state) { using MapWrapperT = MapWrapper; - using KT = typename MapWrapperT::KeyT; - using VT = typename MapWrapperT::ValueT; + using KT = MapWrapperT::KeyT; + using VT = MapWrapperT::ValueT; MapWrapperT m; auto [keys, lookup_keys] = GetKeysAndHitKeys(state.range(0), state.range(1)); @@ -405,8 +405,8 @@ MAP_BENCHMARK_ONE_OP(BM_MapUpdateHit, HitArgs); template static void BM_MapEraseUpdateHit(benchmark::State& state) { using MapWrapperT = MapWrapper; - using KT = typename MapWrapperT::KeyT; - using VT = typename MapWrapperT::ValueT; + using KT = MapWrapperT::KeyT; + using VT = MapWrapperT::ValueT; MapWrapperT m; auto [keys, lookup_keys] = GetKeysAndHitKeys(state.range(0), state.range(1)); @@ -463,8 +463,8 @@ MAP_BENCHMARK_ONE_OP(BM_MapEraseUpdateHit, HitArgs); template static void BM_MapInsertSeq(benchmark::State& state) { using MapWrapperT = MapWrapper; - using KT = typename MapWrapperT::KeyT; - using VT = typename MapWrapperT::ValueT; + using KT = MapWrapperT::KeyT; + using VT = MapWrapperT::ValueT; constexpr ssize_t LookupKeysSize = 1 << 8; auto [keys, lookup_keys] = GetKeysAndHitKeys(state.range(0), LookupKeysSize); diff --git a/common/map_test.cpp b/common/map_test.cpp index 4aa5128c1392..c2ede41181d1 100644 --- a/common/map_test.cpp +++ b/common/map_test.cpp @@ -42,8 +42,8 @@ using ::testing::UnorderedElementsAreArray; template auto ExpectMapElementsAre(MapT&& m, MatcherRangeT element_matchers) -> void { // Now collect the elements into a container. - using KeyT = typename std::remove_reference::type::KeyT; - using ValueT = typename std::remove_reference::type::ValueT; + using KeyT = std::remove_reference::type::KeyT; + using ValueT = std::remove_reference::type::ValueT; std::vector< std::pair, std::reference_wrapper>> map_entries; @@ -68,7 +68,7 @@ auto ExpectMapElementsAre(MapT&& m, template auto MakeKeyValues(ValueCB value_cb, RangeT&& range, RangeTs&&... ranges) -> auto { - using KeyT = typename RangeT::value_type; + using KeyT = RangeT::value_type; using ValueT = decltype(value_cb(std::declval())); std::vector> elements; auto add_range = [&](RangeT&& r) { diff --git a/common/raw_hashtable.h b/common/raw_hashtable.h index 613990af72ae..57d1be6dbd98 100644 --- a/common/raw_hashtable.h +++ b/common/raw_hashtable.h @@ -474,8 +474,8 @@ class BaseImpl { using ValueT = InputValueT; using KeyContextT = InputKeyContextT; using ViewImplT = ViewImpl; - using EntryT = typename ViewImplT::EntryT; - using MetricsT = typename ViewImplT::MetricsT; + using EntryT = ViewImplT::EntryT; + using MetricsT = ViewImplT::MetricsT; BaseImpl(int small_alloc_size, Storage* small_storage) : small_alloc_size_(small_alloc_size) { diff --git a/common/set.h b/common/set.h index 29b462614244..f0b7b4976612 100644 --- a/common/set.h +++ b/common/set.h @@ -56,9 +56,9 @@ class SetView : RawHashtable::ViewImpl { using ImplT = RawHashtable::ViewImpl; public: - using KeyT = typename ImplT::KeyT; - using KeyContextT = typename ImplT::KeyContextT; - using MetricsT = typename ImplT::MetricsT; + using KeyT = ImplT::KeyT; + using KeyContextT = ImplT::KeyContextT; + using MetricsT = ImplT::MetricsT; // This type represents the result of lookup operations. It encodes whether // the lookup was a success as well as accessors for the key. @@ -110,7 +110,7 @@ class SetView : RawHashtable::ViewImpl { friend class SetBase; friend class SetView; - using EntryT = typename ImplT::EntryT; + using EntryT = ImplT::EntryT; SetView() = default; explicit(false) SetView(ImplT base) : ImplT(base) {} @@ -138,11 +138,11 @@ class SetBase using ImplT = RawHashtable::BaseImpl; public: - using KeyT = typename ImplT::KeyT; - using KeyContextT = typename ImplT::KeyContextT; + using KeyT = ImplT::KeyT; + using KeyContextT = ImplT::KeyContextT; using ViewT = SetView; - using LookupResult = typename ViewT::LookupResult; - using MetricsT = typename ImplT::MetricsT; + using LookupResult = ViewT::LookupResult; + using MetricsT = ImplT::MetricsT; // The result type for insertion operations both indicates whether an insert // was needed (as opposed to the key already being in the set), and provides @@ -299,7 +299,7 @@ class Set : public RawHashtable::TableImpl, using ImplT = RawHashtable::TableImpl; public: - using KeyT = typename BaseT::KeyT; + using KeyT = BaseT::KeyT; Set() = default; Set(const Set& arg) = default; diff --git a/common/set_benchmark.cpp b/common/set_benchmark.cpp index 454332f544fd..6c5dc6d809a0 100644 --- a/common/set_benchmark.cpp +++ b/common/set_benchmark.cpp @@ -37,7 +37,7 @@ static constexpr bool IsCarbonSet = IsCarbonSetImpl::value; // supported through specializations. template struct SetWrapperImpl { - using KeyT = typename SetT::key_type; + using KeyT = SetT::key_type; SetT s; @@ -158,7 +158,7 @@ using SetWrapper = template static void BM_SetContainsHitPtr(benchmark::State& state) { using SetWrapperT = SetWrapper; - using KT = typename SetWrapperT::KeyT; + using KT = SetWrapperT::KeyT; SetWrapperT s; auto [keys, lookup_keys] = GetKeysAndHitKeys(state.range(0), state.range(1)); @@ -190,7 +190,7 @@ MAP_BENCHMARK_ONE_OP(BM_SetContainsHitPtr, HitArgs); template static void BM_SetContainsMissPtr(benchmark::State& state) { using SetWrapperT = SetWrapper; - using KT = typename SetWrapperT::KeyT; + using KT = SetWrapperT::KeyT; SetWrapperT s; auto [keys, lookup_keys] = GetKeysAndMissKeys(state.range(0)); for (auto k : keys) { @@ -225,7 +225,7 @@ MAP_BENCHMARK_ONE_OP(BM_SetContainsMissPtr, SizeArgs); template static void BM_SetLookupHitPtr(benchmark::State& state) { using SetWrapperT = SetWrapper; - using KT = typename SetWrapperT::KeyT; + using KT = SetWrapperT::KeyT; SetWrapperT s; auto [keys, lookup_keys] = GetKeysAndHitKeys(state.range(0), state.range(1)); @@ -265,7 +265,7 @@ MAP_BENCHMARK_ONE_OP(BM_SetLookupHitPtr, HitArgs); template static void BM_SetEraseInsertHitPtr(benchmark::State& state) { using SetWrapperT = SetWrapper; - using KT = typename SetWrapperT::KeyT; + using KT = SetWrapperT::KeyT; SetWrapperT s; auto [keys, lookup_keys] = GetKeysAndHitKeys(state.range(0), state.range(1)); @@ -324,7 +324,7 @@ MAP_BENCHMARK_ONE_OP(BM_SetEraseInsertHitPtr, HitArgs); template static void BM_SetInsertSeq(benchmark::State& state) { using SetWrapperT = SetWrapper; - using KT = typename SetWrapperT::KeyT; + using KT = SetWrapperT::KeyT; constexpr ssize_t LookupKeysSize = 1 << 8; auto [keys, lookup_keys] = GetKeysAndHitKeys(state.range(0), LookupKeysSize); diff --git a/common/set_test.cpp b/common/set_test.cpp index f6e2a93820f1..bf8b8fa279a1 100644 --- a/common/set_test.cpp +++ b/common/set_test.cpp @@ -24,7 +24,7 @@ using ::testing::UnorderedElementsAreArray; template auto ExpectSetElementsAre(SetT&& s, MatcherRangeT element_matchers) -> void { // Collect the elements into a container. - using KeyT = typename std::remove_reference::type::KeyT; + using KeyT = std::remove_reference::type::KeyT; std::vector> entries; s.ForEach([&entries](KeyT& k) { entries.push_back(std::ref(k)); }); diff --git a/toolchain/base/canonical_value_store_impl.h b/toolchain/base/canonical_value_store_impl.h index a5f42c102d3c..15b28f175325 100644 --- a/toolchain/base/canonical_value_store_impl.h +++ b/toolchain/base/canonical_value_store_impl.h @@ -16,7 +16,7 @@ CanonicalValueStore::CanonicalValueStore() template CanonicalValueStore::CanonicalValueStore( - typename IdTagType::TagIdType id, int32_t initial_reserved_ids) + IdTagType::TagIdType id, int32_t initial_reserved_ids) requires(!IdTagIsUntagged>) : values_(id, initial_reserved_ids) {} diff --git a/toolchain/base/value_store.h b/toolchain/base/value_store.h index ff842f4e7ac9..0e9de4e6496f 100644 --- a/toolchain/base/value_store.h +++ b/toolchain/base/value_store.h @@ -125,8 +125,8 @@ class ValueStoreEnumerateIterator std::pair> { public: - using IdType = typename ValueStoreT::IdType; - using ConstRefType = typename ValueStoreT::ConstRefType; + using IdType = ValueStoreT::IdType; + using ConstRefType = ValueStoreT::ConstRefType; using ValueType = std::pair; auto operator*() const -> ValueType { diff --git a/toolchain/base/value_store_impl.h b/toolchain/base/value_store_impl.h index a3018699e76d..ae503d30cad1 100644 --- a/toolchain/base/value_store_impl.h +++ b/toolchain/base/value_store_impl.h @@ -21,7 +21,7 @@ ValueStore::ValueStore(IdTagType tag) template ValueStore::ValueStore( - typename ValueStore::IdTagType::TagIdType id, + ValueStore::IdTagType::TagIdType id, int32_t initial_reserved_ids) requires(!IdTagIsUntagged) : tag_(id, initial_reserved_ids) {} @@ -73,8 +73,7 @@ auto ValueStore::Resize(int32_t size, template auto ValueStore::Chunk::UninitializedFill( int32_t fill_count, - typename ValueStore::ConstRefType default_value) - -> void + ValueStore::ConstRefType default_value) -> void requires(std::is_copy_constructible_v) { CARBON_DCHECK(num_ + fill_count <= Capacity()); diff --git a/toolchain/check/eval_inst.h b/toolchain/check/eval_inst.h index 9a029871a6d1..b2ac7c1dc930 100644 --- a/toolchain/check/eval_inst.h +++ b/toolchain/check/eval_inst.h @@ -140,11 +140,10 @@ struct FunctionTypeForEvalConstantInstImpl { -> ConstantEvalResult; }; template -using FunctionTypeForEvalConstantInst = - typename FunctionTypeForEvalConstantInstImpl< - InstT, ConstantKindHasEvalConstantInst(InstT::Kind.constant_kind()), - InstT::Kind.constant_needs_inst_id() != - SemIR::InstConstantNeedsInstIdKind::No>::Type; +using FunctionTypeForEvalConstantInst = FunctionTypeForEvalConstantInstImpl< + InstT, ConstantKindHasEvalConstantInst(InstT::Kind.constant_kind()), + InstT::Kind.constant_needs_inst_id() != + SemIR::InstConstantNeedsInstIdKind::No>::Type; } // namespace Internal diff --git a/toolchain/parse/tree.h b/toolchain/parse/tree.h index 85798beb945e..e480970966a7 100644 --- a/toolchain/parse/tree.h +++ b/toolchain/parse/tree.h @@ -134,7 +134,7 @@ class Tree : public Printable { template auto IsValid(IdT id) const -> bool { - using T = typename NodeForId::TypedNode; + using T = NodeForId::TypedNode; CARBON_DCHECK(node_kind(id) == T::Kind); return !node_has_error(id); } diff --git a/toolchain/parse/tree_and_subtrees.h b/toolchain/parse/tree_and_subtrees.h index 3754ef0a7f61..3ae89d7ba6d1 100644 --- a/toolchain/parse/tree_and_subtrees.h +++ b/toolchain/parse/tree_and_subtrees.h @@ -309,7 +309,7 @@ auto TreeAndSubtrees::Extract(IdT id) const return std::nullopt; } - using T = typename NodeForId::TypedNode; + using T = NodeForId::TypedNode; return ExtractNodeFromChildren(id, children(id)); } diff --git a/toolchain/sem_ir/mangler.h b/toolchain/sem_ir/mangler.h index 99a036a442ee..d629e7613b0e 100644 --- a/toolchain/sem_ir/mangler.h +++ b/toolchain/sem_ir/mangler.h @@ -97,7 +97,7 @@ class Mangler { -> void { std::visit( [&](auto& f) -> void { - using ResultT = typename std::decay_t::ResultType; + using ResultT = std::decay_t::ResultType; if constexpr (std::is_same_v) { os << f.GetOrCompute(file, id); } else {