From 4febf7c4593b5f390d9bd2ec274bfea33c496119 Mon Sep 17 00:00:00 2001 From: josh11b <15258583+josh11b@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:31:00 -0800 Subject: [PATCH] Add capitilization and punctuation to TODO comments (#4486) Co-authored-by: Josh L --- toolchain/check/check.cpp | 5 +++-- toolchain/check/convert.cpp | 2 +- toolchain/check/eval.cpp | 8 ++++---- toolchain/check/handle_binding_pattern.cpp | 4 ++-- toolchain/check/handle_let_and_var.cpp | 2 +- toolchain/check/handle_where.cpp | 6 +++--- toolchain/check/pattern_match.cpp | 6 +++--- toolchain/codegen/codegen.cpp | 2 +- toolchain/diagnostics/diagnostic.cpp | 2 +- toolchain/driver/compile_subcommand.cpp | 2 +- toolchain/language_server/server.cpp | 2 +- toolchain/language_server/server.h | 2 +- toolchain/lower/file_context.cpp | 2 +- toolchain/sem_ir/file.cpp | 4 ++-- toolchain/sem_ir/formatter.cpp | 2 +- toolchain/sem_ir/stringify_type.cpp | 6 +++--- 16 files changed, 29 insertions(+), 28 deletions(-) diff --git a/toolchain/check/check.cpp b/toolchain/check/check.cpp index d0a573201033..a5ec77289589 100644 --- a/toolchain/check/check.cpp +++ b/toolchain/check/check.cpp @@ -819,8 +819,9 @@ static auto CheckRequiredDefinitions(Context& context, break; } case SemIR::InterfaceDecl::Kind: { - // TODO: handle `interface` as well, once we can test it without - // triggering https://github.com/carbon-language/carbon-lang/issues/4071 + // TODO: Handle `interface` as well, once we can test it without + // triggering + // https://github.com/carbon-language/carbon-lang/issues/4071. CARBON_FATAL("TODO: Support interfaces in DiagnoseMissingDefinitions"); } case CARBON_KIND(SemIR::SpecificFunction specific_function): { diff --git a/toolchain/check/convert.cpp b/toolchain/check/convert.cpp index 57bc923c15c6..155808cfd744 100644 --- a/toolchain/check/convert.cpp +++ b/toolchain/check/convert.cpp @@ -1159,7 +1159,7 @@ auto ConvertForExplicitAs(Context& context, Parse::NodeId as_node, {.kind = ConversionTarget::ExplicitAs, .type_id = type_id}); } -// TODO: consider moving this to pattern_match.h +// TODO: Consider moving this to pattern_match.h. auto ConvertCallArgs(Context& context, SemIR::LocId call_loc_id, SemIR::InstId self_id, llvm::ArrayRef arg_refs, diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index c7a70861b25a..9fb9d902789d 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -1310,7 +1310,7 @@ static auto TryEvalInstInContext(EvalContext& eval_context, Phase phase = Phase::Template; SemIR::TypeId base_facet_type_id = GetConstantValue(eval_context, info.base_facet_type_id, &phase); - // TODO: process & canonicalize requirements + // TODO: Process & canonicalize requirements. SemIR::InstBlockId requirement_block_id = info.requirement_block_id; // If nothing changed, can reuse this instruction. if (base_facet_type_id == info.base_facet_type_id && @@ -1401,7 +1401,7 @@ static auto TryEvalInstInContext(EvalContext& eval_context, break; case CARBON_KIND(SemIR::SymbolicBindingPattern bind): { - // TODO: disable constant evaluation of SymbolicBindingPattern once + // TODO: Disable constant evaluation of SymbolicBindingPattern once // DeduceGenericCallArguments no longer needs implicit params to have // constant values. const auto& bind_name = @@ -1457,7 +1457,7 @@ static auto TryEvalInstInContext(EvalContext& eval_context, return eval_context.GetConstantValue(typed_inst.value_id); } case CARBON_KIND(SemIR::ValueParamPattern param_pattern): { - // TODO: treat this as a non-expression (here and in GetExprCategory) + // TODO: Treat this as a non-expression (here and in GetExprCategory) // once generic deduction doesn't need patterns to have constant values. return eval_context.GetConstantValue(param_pattern.subpattern_id); } @@ -1485,7 +1485,7 @@ static auto TryEvalInstInContext(EvalContext& eval_context, base_facet_type_id = GetConstantValue(eval_context, base_facet_type_id, &phase); SemIR::InstBlockId requirement_block_id = typed_inst.requirements_id; - // TODO: process & canonicalize requirements + // TODO: Process & canonicalize requirements. return MakeFacetTypeResult(eval_context.context(), base_facet_type_id, requirement_block_id, phase); } diff --git a/toolchain/check/handle_binding_pattern.cpp b/toolchain/check/handle_binding_pattern.cpp index afe76b914bf5..c1e9715b7d96 100644 --- a/toolchain/check/handle_binding_pattern.cpp +++ b/toolchain/check/handle_binding_pattern.cpp @@ -243,7 +243,7 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id, } context.node_stack().Push(node_id, param_pattern_id); - // TODO: use the pattern insts to generate the pattern-match insts + // TODO: Use the pattern insts to generate the pattern-match insts // at the end of the full pattern, instead of eagerly generating them // here. break; @@ -285,7 +285,7 @@ auto HandleParseNode(Context& context, if (context.decl_introducer_state_stack().innermost().kind == Lex::TokenKind::Let) { // Disallow `let` outside of function and interface definitions. - // TODO: find a less brittle way of doing this. An invalid scope_inst_id + // TODO: Find a less brittle way of doing this. An invalid scope_inst_id // can represent a block scope, but is also used for other kinds of scopes // that aren't necessarily part of an interface or function decl. auto scope_inst_id = context.scope_stack().PeekInstId(); diff --git a/toolchain/check/handle_let_and_var.cpp b/toolchain/check/handle_let_and_var.cpp index 4887bef9083e..cc6e34e2e9df 100644 --- a/toolchain/check/handle_let_and_var.cpp +++ b/toolchain/check/handle_let_and_var.cpp @@ -147,7 +147,7 @@ static auto HandleDecl(Context& context, NodeT node_id) -> std::optional { std::optional decl_info = DeclInfo(); - // TODO: update binding-pattern handling to use the pattern block even in + // TODO: Update binding-pattern handling to use the pattern block even in // a let/var context, and then consume it here. context.pattern_block_stack().PopAndDiscard(); diff --git a/toolchain/check/handle_where.cpp b/toolchain/check/handle_where.cpp index f2968fdb3d83..7fdabacb2854 100644 --- a/toolchain/check/handle_where.cpp +++ b/toolchain/check/handle_where.cpp @@ -78,8 +78,8 @@ auto HandleParseNode(Context& context, Parse::RequirementEqualEqualId node_id) -> bool { auto rhs = context.node_stack().PopExpr(); auto lhs = context.node_stack().PopExpr(); - // TODO: type check lhs and rhs are comparable - // TODO: require that at least one side uses a designator + // TODO: Type check lhs and rhs are comparable. + // TODO: Require that at least one side uses a designator. // Build up the list of arguments for the `WhereExpr` inst. context.args_type_info_stack().AddInstId( @@ -104,7 +104,7 @@ auto HandleParseNode(Context& context, Parse::RequirementImplsId node_id) context.emitter().Emit(rhs_node, ImplsOnNonFacetType); rhs_as_type.inst_id = SemIR::InstId::BuiltinError; } - // TODO: require that at least one side uses a designator + // TODO: Require that at least one side uses a designator. // Build up the list of arguments for the `WhereExpr` inst. context.args_type_info_stack().AddInstId( diff --git a/toolchain/check/pattern_match.cpp b/toolchain/check/pattern_match.cpp index 59f721450114..d0fbf1923745 100644 --- a/toolchain/check/pattern_match.cpp +++ b/toolchain/check/pattern_match.cpp @@ -46,7 +46,7 @@ enum class MatchKind { // against the portion of the pattern below the ParamPattern insts. Callee, - // TODO: add enumerator for non-function-call pattern match + // TODO: Add enumerator for non-function-call pattern match. }; // The collected state of a pattern-matching operation. @@ -115,7 +115,7 @@ class MatchContext { SemIR::SpecificId callee_specific_id_; // The return slot inst emitted by `DoWork`, if any. - // TODO: can this be added to the block returned by `DoWork`, instead? + // TODO: Can this be added to the block returned by `DoWork`, instead? SemIR::InstId return_slot_id_; }; @@ -251,7 +251,7 @@ auto MatchContext::EmitPatternMatch(Context& context, break; } case MatchKind::Callee: { - // TODO: consider ways to address near-duplication with the + // TODO: Consider ways to address near-duplication with the // ValueParamPattern case. if (param_pattern.runtime_index == SemIR::RuntimeParamIndex::Unknown) { diff --git a/toolchain/codegen/codegen.cpp b/toolchain/codegen/codegen.cpp index ad0de8fb0733..5696ff2d1e32 100644 --- a/toolchain/codegen/codegen.cpp +++ b/toolchain/codegen/codegen.cpp @@ -49,7 +49,7 @@ auto CodeGen::EmitCode(llvm::raw_pwrite_stream& out, // Using the legacy PM to generate the assembly since the new PM // does not work with this yet. - // TODO: make the new PM work with the codegen pipeline. + // TODO: Make the new PM work with the codegen pipeline. llvm::legacy::PassManager pass; // Note that this returns true on an error. if (target_machine_->addPassesToEmitFile(pass, out, nullptr, file_type)) { diff --git a/toolchain/diagnostics/diagnostic.cpp b/toolchain/diagnostics/diagnostic.cpp index d7a03287ab7d..6134c5988ce5 100644 --- a/toolchain/diagnostics/diagnostic.cpp +++ b/toolchain/diagnostics/diagnostic.cpp @@ -34,7 +34,7 @@ auto DiagnosticLoc::FormatSnippet(llvm::raw_ostream& out, int indent) const out << "^"; // We want to ensure that we don't underline past the end of the line in // case of a multiline token. - // TODO: revisit this once we can reference multiple ranges on multiple + // TODO: Revisit this once we can reference multiple ranges on multiple // lines in a single diagnostic message. int underline_length = std::min(length, static_cast(line.size()) - column); diff --git a/toolchain/driver/compile_subcommand.cpp b/toolchain/driver/compile_subcommand.cpp index d399025a37a2..8b38797cc03f 100644 --- a/toolchain/driver/compile_subcommand.cpp +++ b/toolchain/driver/compile_subcommand.cpp @@ -526,7 +526,7 @@ class CompilationUnit { } if (options_.output_filename == "-") { - // TODO: the output file name, forcing object output, and requesting + // TODO: The output file name, forcing object output, and requesting // textual assembly output are all somewhat linked flags. We should add // some validation that they are used correctly. if (options_.force_obj_output) { diff --git a/toolchain/language_server/server.cpp b/toolchain/language_server/server.cpp index 582b4ae14552..7847f317e407 100644 --- a/toolchain/language_server/server.cpp +++ b/toolchain/language_server/server.cpp @@ -81,7 +81,7 @@ auto Server::onCall(llvm::StringRef method, llvm::json::Value params, llvm::json::Value id) -> bool { if (auto handler = handlers_.MethodHandlers.find(method); handler != handlers_.MethodHandlers.end()) { - // TODO: improve this if add threads + // TODO: Improve this if add threads. handler->second(std::move(params), [&](llvm::Expected reply) { transport_->reply(id, std::move(reply)); diff --git a/toolchain/language_server/server.h b/toolchain/language_server/server.h index 1cd436dc4cb6..08afe932e65c 100644 --- a/toolchain/language_server/server.h +++ b/toolchain/language_server/server.h @@ -46,7 +46,7 @@ class Server : public clang::clangd::Transport::MessageHandler, auto callMethod(llvm::StringRef method, llvm::json::Value params, clang::clangd::Callback reply) -> void override { - // TODO: implement when needed + // TODO: Implement when needed. } // Send notification to client diff --git a/toolchain/lower/file_context.cpp b/toolchain/lower/file_context.cpp index 8fa7e961812f..f32dc6a3f901 100644 --- a/toolchain/lower/file_context.cpp +++ b/toolchain/lower/file_context.cpp @@ -355,7 +355,7 @@ auto FileContext::BuildFunctionDefinition(SemIR::FunctionId function_id) calling_convention_param_ids.push_back(return_slot.storage_id); } - // TODO: find a way to ensure this code and the function-call lowering use + // TODO: Find a way to ensure this code and the function-call lowering use // the same parameter ordering. // Lowers the given parameter. Must be called in LLVM calling convention diff --git a/toolchain/sem_ir/file.cpp b/toolchain/sem_ir/file.cpp index a08ca175928b..c117ea628742 100644 --- a/toolchain/sem_ir/file.cpp +++ b/toolchain/sem_ir/file.cpp @@ -294,7 +294,7 @@ auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory { } case CARBON_KIND(BindName inst): { - // TODO: don't rely on value_id for expression category, since it may + // TODO: Don't rely on value_id for expression category, since it may // not be valid yet. This workaround only works because we don't support // `var` in function signatures yet. if (!inst.value_id.is_valid()) { @@ -356,7 +356,7 @@ auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory { return ExprCategory::EphemeralRef; case OutParam::Kind: - // TODO: consider introducing a separate category for OutParam: + // TODO: Consider introducing a separate category for OutParam: // unlike other DurableRefs, it permits initialization. return ExprCategory::DurableRef; } diff --git a/toolchain/sem_ir/formatter.cpp b/toolchain/sem_ir/formatter.cpp index f54530d27d90..5fcbc7f4b161 100644 --- a/toolchain/sem_ir/formatter.cpp +++ b/toolchain/sem_ir/formatter.cpp @@ -961,7 +961,7 @@ class FormatterImpl { out_ << ""; diff --git a/toolchain/sem_ir/stringify_type.cpp b/toolchain/sem_ir/stringify_type.cpp index 936f58de668d..c47ef4ef6d50 100644 --- a/toolchain/sem_ir/stringify_type.cpp +++ b/toolchain/sem_ir/stringify_type.cpp @@ -126,7 +126,7 @@ auto StringifyTypeExpr(const SemIR::File& outer_sem_ir, InstId outer_inst_id) steps.push_back(step.Next()); FacetTypeInfo facet_type_info = sem_ir.facet_types().Get(inst.facet_type_id); - // TODO: also output restrictions from + // TODO: Also output restrictions from // facet_type_info.requirement_block_id. TypeId type_id = facet_type_info.base_facet_type_id; push_inst_id(sem_ir.types().GetInstId(type_id)); @@ -266,8 +266,8 @@ auto StringifyTypeExpr(const SemIR::File& outer_sem_ir, InstId outer_inst_id) steps.push_back(step.Next()); TypeId type_id = sem_ir.insts().Get(inst.period_self_id).type_id(); push_inst_id(sem_ir.types().GetInstId(type_id)); - // TODO: also output restrictions from the inst block - // inst.requirements_id + // TODO: Also output restrictions from the inst block + // inst.requirements_id. } else { out << ">"; }