mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Use lines instead of statements for readability-function-size clang-tidy (#6594)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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_);
|
||||
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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) \
|
||||
{ \
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user