Use lines instead of statements for readability-function-size clang-tidy (#6594)

This commit is contained in:
Geoff Romer
2026-01-14 19:32:03 +00:00
committed by GitHub
parent d8adcf93f5
commit 9106f9533c
8 changed files with 9 additions and 8 deletions
+9
View File
@@ -143,3 +143,12 @@ CheckOptions:
# Don't require writing a return type on lambdas.
- key: modernize-use-trailing-return-type.TransformLambdas
value: none
# Use lines rather than statements to measure function size, because
# for readability purposes we care about the code as written, before
# preprocessing.
- key: readability-function-size.StatementThreshold
value: none
- key: readability-function-size.LineThreshold
# Chose 800 to match the default for StatementThreshold.
value: 800
-1
View File
@@ -374,7 +374,6 @@ auto CheckUnit::ImportOtherPackages(SemIR::TypeId namespace_type_id) -> void {
// Loops over all nodes in the tree. On some errors, this may return early,
// for example if an unrecoverable state is encountered.
// NOLINTNEXTLINE(readability-function-size)
auto CheckUnit::ProcessNodeIds() -> bool {
NodeIdTraversal traversal(&context_);
-1
View File
@@ -185,7 +185,6 @@ class CheckUnit {
// Loops over all nodes in the tree. On some errors, this may return early,
// for example if an unrecoverable state is encountered.
// NOLINTNEXTLINE(readability-function-size)
auto ProcessNodeIds() -> bool;
UnitAndImports* unit_and_imports_;
-1
View File
@@ -37,7 +37,6 @@ auto NodeStack::PrintForStackDump(int indent, llvm::raw_ostream& output) const
}
}
// NOLINTNEXTLINE(readability-function-size)
auto NodeStack::CheckIdKindTable() -> void {
#define CARBON_PARSE_NODE_KIND(Name) \
{ \
-1
View File
@@ -325,7 +325,6 @@ static auto MaybeEmitAsConstant(ConstantContext& context, InstT inst)
}
}
// NOLINTNEXTLINE(readability-function-size): Macro-generated.
auto LowerConstants(FileContext& file_context,
FileContext::LoweredConstantStore& constants) -> void {
ConstantContext context(file_context, &constants);
-1
View File
@@ -113,7 +113,6 @@ static auto LowerInstHelper(FunctionContext& context, SemIR::InstId inst_id,
// TODO: Consider renaming Handle##Name, instead relying on typed_inst overload
// resolution. That would allow putting the nonexistent handler implementations
// in `requires`-style overloads.
// NOLINTNEXTLINE(readability-function-size): The define confuses lint.
auto FunctionContext::LowerInst(SemIR::InstId inst_id) -> void {
// Skip over constants. `FileContext::GetConstant` lowers them as needed.
if (sem_ir().constant_values().Get(inst_id).is_constant()) {
-2
View File
@@ -22,7 +22,6 @@ static auto AsAnyInstId(Inst::ArgAndKind arg) -> InstId {
return arg.As<SemIR::AbsoluteInstId>();
}
// NOLINTBEGIN(readability-function-size)
auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory {
const File* ir = &file;
@@ -137,7 +136,6 @@ auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory {
}
}
}
// NOLINTEND(readability-function-size)
auto FindReturnSlotArgForInitializer(const File& sem_ir, InstId init_id)
-> InstId {
-1
View File
@@ -734,7 +734,6 @@ class Stringifier {
} // namespace
// NOLINTNEXTLINE(readability-function-size)
static auto Stringify(const File& sem_ir, StepStack& step_stack)
-> std::string {
RawStringOstream out;