Clean up clang-tidy issues in explorer. (#2621)

google-readability-function-size and readability-function-size were _both_ triggering on TypeCheckExp. It looks like the Google version may be a subset of the general version, so I've disabled the Google version while keeping the general version and adding a NOLINT for it.

I manually removed the `const` in cases like `Nonnull<const VTable* const>` based on the readability-const-return-type warning. i.e., where a return type is a pointer, the `const` isn't meaningful and the tidy check was warning about that.

Added a NOLINT for misc-definitions-in-headers on IsRecursivelyTransformable. I think that's the right choice for the `constexpr`, the warning didn't feel accurate and may be getting confused by the templating.

I changed the structure of `carbon_files` in the fuzzer because the `new` was causing a warning about exceptions. However, also disabling bugprone-exception-escape because it's what was flagging this and it's not really a helpful warning.

Other changes were automated.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Jon Ross-Perkins
2023-03-01 13:12:51 -08:00
committed by GitHub
co-authored by Richard Smith
parent 16f86471e7
commit 7fe8bb308b
10 changed files with 32 additions and 26 deletions
+9 -9
View File
@@ -17,7 +17,7 @@ namespace Carbon {
// and adds them to the signature of a `Match` object.
class MatchingImplSet::LeafCollector {
public:
LeafCollector(Match* match) : match_(match) {}
explicit LeafCollector(Match* match) : match_(match) {}
void Collect(const Value* value) {
value->Visit<void>(
@@ -28,15 +28,15 @@ class MatchingImplSet::LeafCollector {
private:
// Most kinds of value don't contribute to the signature.
void VisitValue(const Value*) {}
void VisitValue(const Value* /*unused*/) {}
void VisitValue(const TypeType*) { Collect(Label::TypeType); }
void VisitValue(const TypeType* /*unused*/) { Collect(Label::TypeType); }
void VisitValue(const BoolType*) { Collect(Label::BoolType); }
void VisitValue(const BoolType* /*unused*/) { Collect(Label::BoolType); }
void VisitValue(const IntType*) { Collect(Label::IntType); }
void VisitValue(const IntType* /*unused*/) { Collect(Label::IntType); }
void VisitValue(const StringType*) { Collect(Label::StringType); }
void VisitValue(const StringType* /*unused*/) { Collect(Label::StringType); }
void VisitValue(const StaticArrayType* array) {
Collect(Label::ArrayType);
@@ -57,7 +57,7 @@ class MatchingImplSet::LeafCollector {
void VisitValue(const TupleType* tuple_type) {
Collect(Label::TupleType);
for (auto* elem_type : tuple_type->elements()) {
for (const auto* elem_type : tuple_type->elements()) {
Collect(elem_type);
}
}
@@ -92,7 +92,6 @@ class MatchingImplSet::LeafCollector {
}
}
private:
Match* match_;
};
@@ -100,7 +99,8 @@ auto MatchingImplSet::GetLabelForDeclaration(const Declaration& declaration)
-> Label {
auto [it, added] = declaration_labels_.insert(
{&declaration,
Label(int(Label::FirstDeclarationLabel) + declaration_labels_.size())});
static_cast<Label>(static_cast<int>(Label::FirstDeclarationLabel) +
declaration_labels_.size())});
return it->second;
}