diff --git a/testing/fuzzing/libfuzzer.h b/testing/fuzzing/libfuzzer.h index df04c44ad34c1..90b3425336381 100644 --- a/testing/fuzzing/libfuzzer.h +++ b/testing/fuzzing/libfuzzer.h @@ -14,8 +14,7 @@ namespace Carbon::Testing { // defining an undeclared extern function due to a Clang warning bug: // https://github.com/llvm/llvm-project/issues/94138 // NOLINTNEXTLINE: Match the documented fuzzer entry point declaration style. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, - std::size_t size); +extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size); // Optional API that can be implemented but isn't required. This allows fuzzers // to observe the `argv` during initialization. diff --git a/toolchain/check/check.cpp b/toolchain/check/check.cpp index 24bbb1d69c632..e49dac81f2be8 100644 --- a/toolchain/check/check.cpp +++ b/toolchain/check/check.cpp @@ -387,7 +387,7 @@ class NextDeferredDefinitionCache { // be encountered. auto SkipTo(Parse::DeferredDefinitionIndex next_index) -> void { index_ = next_index; - if (static_cast(index_.index) == + if (static_cast(index_.index) == tree_->deferred_definitions().size()) { start_id_ = Parse::NodeId::Invalid; } else { diff --git a/toolchain/check/check_fuzzer.cpp b/toolchain/check/check_fuzzer.cpp index fdad09d5b06f1..463f40bc6a6c8 100644 --- a/toolchain/check/check_fuzzer.cpp +++ b/toolchain/check/check_fuzzer.cpp @@ -22,8 +22,7 @@ extern "C" auto LLVMFuzzerInitialize(int* argc, char*** argv) -> int { } // NOLINTNEXTLINE: Match the documented fuzzer entry point declaration style. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, - std::size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { // Ignore large inputs. // TODO: See tokenized_buffer_fuzzer.cpp. if (size > 100000) { diff --git a/toolchain/check/context.cpp b/toolchain/check/context.cpp index 9a7af983969b6..143eac7a400b1 100644 --- a/toolchain/check/context.cpp +++ b/toolchain/check/context.cpp @@ -1028,7 +1028,7 @@ class TypeCompleter { llvm_unreachable("All builtin kinds were handled above"); } - auto BuildStructOrTupleValueRepr(std::size_t num_elements, + auto BuildStructOrTupleValueRepr(size_t num_elements, SemIR::TypeId elementwise_rep, bool same_as_object_rep) const -> SemIR::ValueRepr { diff --git a/toolchain/check/convert.cpp b/toolchain/check/convert.cpp index 20b3ee538c14d..3c7622aeda516 100644 --- a/toolchain/check/convert.cpp +++ b/toolchain/check/convert.cpp @@ -147,7 +147,7 @@ template static auto MakeElementAccessInst(Context& context, SemIR::LocId loc_id, SemIR::InstId aggregate_id, SemIR::TypeId elem_type_id, InstBlockT& block, - std::size_t i) { + size_t i) { if constexpr (std::is_same_v) { // TODO: Add a new instruction kind for indexing an array at a constant // index so that we don't need an integer literal instruction here, and @@ -183,7 +183,7 @@ static auto ConvertAggregateElement( SemIR::TypeId src_elem_type, llvm::ArrayRef src_literal_elems, ConversionTarget::Kind kind, SemIR::InstId target_id, - SemIR::TypeId target_elem_type, PendingBlock* target_block, std::size_t i) { + SemIR::TypeId target_elem_type, PendingBlock* target_block, size_t i) { // Compute the location of the source element. This goes into the current code // block, not into the target block. // TODO: Ideally we would discard this instruction if it's unused. diff --git a/toolchain/diagnostics/diagnostic_emitter.h b/toolchain/diagnostics/diagnostic_emitter.h index a03da49a56427..761a9e68f2b63 100644 --- a/toolchain/diagnostics/diagnostic_emitter.h +++ b/toolchain/diagnostics/diagnostic_emitter.h @@ -151,7 +151,7 @@ class DiagnosticEmitter { // TODO: Custom formatting can be provided with an format_provider, but that // affects all formatv calls. Consider replacing formatv with a custom call // that allows diagnostic-specific formatting. - template + template static auto FormatFn(const DiagnosticMessage& message, std::index_sequence /*indices*/) -> std::string { static_assert(sizeof...(Args) == sizeof...(N), "Invalid template args"); diff --git a/toolchain/lex/numeric_literal_fuzzer.cpp b/toolchain/lex/numeric_literal_fuzzer.cpp index 371dfe25abf79..411e8bad63d02 100644 --- a/toolchain/lex/numeric_literal_fuzzer.cpp +++ b/toolchain/lex/numeric_literal_fuzzer.cpp @@ -12,8 +12,7 @@ namespace Carbon::Testing { // NOLINTNEXTLINE: Match the documented fuzzer entry point declaration style. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, - std::size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { auto token = Lex::NumericLiteral::Lex( llvm::StringRef(reinterpret_cast(data), size)); if (!token) { diff --git a/toolchain/lex/string_literal_fuzzer.cpp b/toolchain/lex/string_literal_fuzzer.cpp index c38ec1d6de160..db88b9e7ebbec 100644 --- a/toolchain/lex/string_literal_fuzzer.cpp +++ b/toolchain/lex/string_literal_fuzzer.cpp @@ -13,8 +13,7 @@ namespace Carbon::Testing { // NOLINTNEXTLINE: Match the documented fuzzer entry point declaration style. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, - std::size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { auto token = Lex::StringLiteral::Lex( llvm::StringRef(reinterpret_cast(data), size)); if (!token) { diff --git a/toolchain/lex/tokenized_buffer_fuzzer.cpp b/toolchain/lex/tokenized_buffer_fuzzer.cpp index 37117bfc06703..65aa75a179be8 100644 --- a/toolchain/lex/tokenized_buffer_fuzzer.cpp +++ b/toolchain/lex/tokenized_buffer_fuzzer.cpp @@ -14,8 +14,7 @@ namespace Carbon::Testing { // NOLINTNEXTLINE: Match the documented fuzzer entry point declaration style. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, - std::size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { // Ignore large inputs. // TODO: Investigate replacement with an error limit. Content with errors on // escaped quotes (`\"` repeated) have O(M * N) behavior for M errors in a diff --git a/toolchain/parse/extract.cpp b/toolchain/parse/extract.cpp index 3027f4773b4db..7106754d9fef7 100644 --- a/toolchain/parse/extract.cpp +++ b/toolchain/parse/extract.cpp @@ -71,7 +71,7 @@ class NodeExtractor { // Extracts a tuple-like type `T` by extracting its components and then // assembling a `T` value. - template + template auto ExtractTupleLikeType(std::index_sequence /*indices*/, std::tuple* /*type*/) -> std::optional; @@ -334,7 +334,7 @@ struct Extractable { } }; -template +template auto NodeExtractor::ExtractTupleLikeType( std::index_sequence /*indices*/, std::tuple* /*type*/) -> std::optional { diff --git a/toolchain/parse/parse_fuzzer.cpp b/toolchain/parse/parse_fuzzer.cpp index 70c292cd3a95b..7db9abc91e887 100644 --- a/toolchain/parse/parse_fuzzer.cpp +++ b/toolchain/parse/parse_fuzzer.cpp @@ -15,8 +15,7 @@ namespace Carbon::Testing { // NOLINTNEXTLINE: Match the documented fuzzer entry point declaration style. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, - std::size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { // Ignore large inputs. // TODO: See tokenized_buffer_fuzzer.cpp. if (size > 100000) { diff --git a/toolchain/sem_ir/block_value_store.h b/toolchain/sem_ir/block_value_store.h index 6149d7affe4a3..f5f812d611bfb 100644 --- a/toolchain/sem_ir/block_value_store.h +++ b/toolchain/sem_ir/block_value_store.h @@ -123,7 +123,7 @@ class BlockValueStore : public Yaml::Printable> { class KeyContext; // Allocates an uninitialized array using our slab allocator. - auto AllocateUninitialized(std::size_t size) + auto AllocateUninitialized(size_t size) -> llvm::MutableArrayRef { // We're not going to run a destructor, so ensure that's OK. static_assert(std::is_trivially_destructible_v); diff --git a/toolchain/sem_ir/builtin_function_kind.cpp b/toolchain/sem_ir/builtin_function_kind.cpp index 16ecdeb91de32..99c74cdf62232 100644 --- a/toolchain/sem_ir/builtin_function_kind.cpp +++ b/toolchain/sem_ir/builtin_function_kind.cpp @@ -137,7 +137,7 @@ static auto ValidateSignature(const File& sem_ir, } // Argument types must match. - if (![&](std::index_sequence) { + if (![&](std::index_sequence) { return ((SignatureTraits::template arg_t::Check( sem_ir, state, arg_types[Indexes])) && ...); diff --git a/toolchain/sem_ir/id_kind.h b/toolchain/sem_ir/id_kind.h index e2dd9d0975522..efe5c5b059046 100644 --- a/toolchain/sem_ir/id_kind.h +++ b/toolchain/sem_ir/id_kind.h @@ -16,8 +16,8 @@ namespace Carbon::SemIR { template class TypeEnum { public: - static constexpr std::size_t NumTypes = sizeof...(Types); - static constexpr std::size_t NumValues = NumTypes + 2; + static constexpr size_t NumTypes = sizeof...(Types); + static constexpr size_t NumValues = NumTypes + 2; static_assert(NumValues <= 256, "Too many types for raw enum."); @@ -87,8 +87,8 @@ class TypeEnum { // Returns a value that can be used as an array index. Returned value will be // < NumValues. - constexpr auto ToIndex() const -> std::size_t { - return static_cast(value_); + constexpr auto ToIndex() const -> size_t { + return static_cast(value_); } // Returns whether this is a valid value, not `Invalid`. diff --git a/toolchain/sem_ir/typed_insts_test.cpp b/toolchain/sem_ir/typed_insts_test.cpp index bc2c5bf121f00..78d990407b58c 100644 --- a/toolchain/sem_ir/typed_insts_test.cpp +++ b/toolchain/sem_ir/typed_insts_test.cpp @@ -95,7 +95,7 @@ TEST(TypedInstTest, RoundTrip) { #include "toolchain/sem_ir/inst_kind.def" } -auto StructLayoutHelper(void* typed_inst, std::size_t typed_inst_size, +auto StructLayoutHelper(void* typed_inst, size_t typed_inst_size, bool has_type_id) -> void { // Check that the memory representation of the typed instruction is what we // expect.