Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5ffe1f4

Browse files
authored
Update HeaderFilterRegex once and for all. (#48145)
Includes a test (`header_filter_regex_test.dart`) that hopefully keeps us on rails going forward.
1 parent 0430f98 commit 5ffe1f4

33 files changed

+250
-141
lines changed

.clang-tidy

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,19 @@ CheckOptions:
4545
- key: readability-identifier-naming.PrivateMemberSuffix
4646
value: "_"
4747

48-
# Lint headers within paths that contain "/flutter/" but not:
49-
# - gen (generated code, the fact it compiles is good enough™)
50-
# - third_party (we didn't author most of the code, and can't fix the lints)
48+
# Intended to include (lint) all headers except:
49+
# ... those in ../../gen (generated files don't need to follow clang tidy)
50+
# ... those in flutter/third_party (we didn't author this code, it's a dep)
5151
#
52-
# Note this is because of our buildroot setup, so the full path of a lint is:
53-
# "../../flutter/impeller/core/runtime_types.h:1:1" as reported.
54-
HeaderFilterRegex: "(!third_party/)(!gen/).*/flutter/.*"
52+
# Unfortunately Clang Tidy uses an ancient version of regular expressions
53+
# without lookaheads, so the next best thing is to write out every directory
54+
# except third_party.
55+
#
56+
# If we ever add a new root directory, we'll have to update this expression.
57+
#
58+
# See the test in ./tools/clang_tidy/test/header_filter_regex_test.dart which
59+
# should theoretically catch if new directories are added but this regex is not
60+
# updated.
61+
#
62+
# tl;dr: I'm sorry.
63+
HeaderFilterRegex: "[..\/]+\/flutter\/(assets|benchmarking|build|ci|common|display_list|docs|examples|flow|flutter_frontend_server|flutter_vma|fml|impeller|lib|runtime|shell|skia|sky|testing|tools|vulkan|wasm|web_sdk)\/.*"

impeller/renderer/vertex_buffer_builder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class VertexBufferBuilder {
4242
return impeller::IndexType::kUnknown;
4343
}
4444

45-
void SetLabel(std::string label) { label_ = std::move(label); }
45+
void SetLabel(const std::string& label) { label_ = label; }
4646

4747
void Reserve(size_t count) { return vertices_.reserve(count); }
4848

shell/common/shell_test_platform_view_metal.mm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@
3131
// non-Objective-C TUs.
3232
class DarwinContextMetal {
3333
public:
34-
explicit DarwinContextMetal(bool impeller,
35-
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch)
34+
explicit DarwinContextMetal(
35+
bool impeller,
36+
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
3637
: context_(impeller ? nil : [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice]),
37-
impeller_context_(impeller ? [[FlutterDarwinContextMetalImpeller alloc]
38-
init:std::move(is_gpu_disabled_sync_switch)]
39-
: nil),
38+
impeller_context_(
39+
impeller ? [[FlutterDarwinContextMetalImpeller alloc] init:is_gpu_disabled_sync_switch]
40+
: nil),
4041
offscreen_texture_(CreateOffscreenTexture(
4142
impeller ? [impeller_context_ context]->GetMTLDevice() : [context_ device])) {}
4243

shell/platform/darwin/common/framework/Source/FlutterStandardCodecHelper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ typedef enum {
5454
// NOLINTEND(readability-identifier-naming)
5555
} FlutterStandardCodecObjcType;
5656

57+
// NOLINTBEGIN(google-objc-function-naming)
58+
5759
///////////////////////////////////////////////////////////////////////////////
5860
///\name Reader Helpers
5961
///@{
@@ -111,6 +113,7 @@ bool FlutterStandardCodecHelperWriteNumber(CFMutableDataRef data,
111113

112114
///@}
113115

116+
// NOLINTEND(google-objc-function-naming)
114117
// NOLINTEND(google-runtime-int)
115118

116119
#if defined(__cplusplus)

shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
2525
/**
2626
* Initializes a FlutterDarwinContextMetalImpeller.
2727
*/
28-
- (instancetype)init:(std::shared_ptr<const fml::SyncSwitch>)is_gpu_disabled_sync_switch;
28+
- (instancetype)init:(const std::shared_ptr<const fml::SyncSwitch>&)is_gpu_disabled_sync_switch;
2929

3030
/**
3131
* Creates an external texture with the specified ID and contents.

shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@
2020
FLUTTER_ASSERT_ARC
2121

2222
static std::shared_ptr<impeller::ContextMTL> CreateImpellerContext(
23-
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch) {
23+
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch) {
2424
std::vector<std::shared_ptr<fml::Mapping>> shader_mappings = {
25-
std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_data,
26-
impeller_entity_shaders_length),
25+
std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_data,
26+
impeller_entity_shaders_length),
2727
#if IMPELLER_ENABLE_3D
28-
std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_data,
29-
impeller_scene_shaders_length),
28+
std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_data,
29+
impeller_scene_shaders_length),
3030
#endif // IMPELLER_ENABLE_3D
31-
std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_data,
32-
impeller_modern_shaders_length),
33-
std::make_shared<fml::NonOwnedMapping>(impeller_framebuffer_blend_shaders_data,
34-
impeller_framebuffer_blend_shaders_length),
31+
std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_data,
32+
impeller_modern_shaders_length),
33+
std::make_shared<fml::NonOwnedMapping>(impeller_framebuffer_blend_shaders_data,
34+
impeller_framebuffer_blend_shaders_length),
3535
};
36-
auto context = impeller::ContextMTL::Create(
37-
shader_mappings, std::move(is_gpu_disabled_sync_switch), "Impeller Library");
36+
auto context = impeller::ContextMTL::Create(shader_mappings, is_gpu_disabled_sync_switch,
37+
"Impeller Library");
3838
if (!context) {
3939
FML_LOG(ERROR) << "Could not create Metal Impeller Context.";
4040
return nullptr;
@@ -46,10 +46,10 @@
4646

4747
@implementation FlutterDarwinContextMetalImpeller
4848

49-
- (instancetype)init:(std::shared_ptr<const fml::SyncSwitch>)is_gpu_disabled_sync_switch {
49+
- (instancetype)init:(const std::shared_ptr<const fml::SyncSwitch>&)is_gpu_disabled_sync_switch {
5050
self = [super init];
5151
if (self != nil) {
52-
_context = CreateImpellerContext(std::move(is_gpu_disabled_sync_switch));
52+
_context = CreateImpellerContext(is_gpu_disabled_sync_switch);
5353
id<MTLDevice> device = _context->GetMTLDevice();
5454
if (!device) {
5555
FML_DLOG(ERROR) << "Could not acquire Metal device.";

shell/platform/darwin/ios/framework/Headers/FlutterEngine.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ NS_ASSUME_NONNULL_BEGIN
2222
* The dart entrypoint that is associated with `main()`. This is to be used as an argument to the
2323
* `runWithEntrypoint*` methods.
2424
*/
25+
// NOLINTNEXTLINE(readability-identifier-naming)
2526
extern NSString* const FlutterDefaultDartEntrypoint;
2627

2728
/**
2829
* The default Flutter initial route ("/").
2930
*/
31+
// NOLINTNEXTLINE(readability-identifier-naming)
3032
extern NSString* const FlutterDefaultInitialRoute;
3133

3234
/**

shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ typedef void (*FlutterPluginRegistrantCallback)(NSObject<FlutterPluginRegistry>*
250250
* Flutter Framework (e.g. When an interact-able widget is covering the platform view).
251251
*/
252252
typedef enum {
253+
// NOLINTBEGIN(readability-identifier-naming)
253254
/**
254255
* Flutter blocks all the UIGestureRecognizers on the platform view as soon as it
255256
* decides they should be blocked.
@@ -266,6 +267,7 @@ typedef enum {
266267
* but never recognizing the gesture (and never invoking actions).
267268
*/
268269
FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded,
270+
// NOLINTEND(readability-identifier-naming)
269271
} FlutterPlatformViewGestureRecognizersBlockingPolicy;
270272

271273
#pragma mark -

shell/platform/darwin/ios/framework/Headers/FlutterViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
2626
* with the update.
2727
*/
2828
FLUTTER_DARWIN_EXPORT
29+
// NOLINTNEXTLINE(readability-identifier-naming)
2930
extern NSNotificationName const FlutterSemanticsUpdateNotification;
3031

3132
/**

shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponder.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@
77

88
#import <Foundation/NSObject.h>
99
#import <UIKit/UIKit.h>
10+
1011
#include "fml/memory/weak_ptr.h"
1112

1213
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h"
1314
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyPrimaryResponder.h"
1415
#import "flutter/shell/platform/embedder/embedder.h"
1516

16-
namespace {
17-
typedef void* _VoidPtr;
18-
}
19-
2017
typedef void (^FlutterSendKeyEvent)(const FlutterKeyEvent& /* event */,
2118
_Nullable FlutterKeyEventCallback /* callback */,
22-
_Nullable _VoidPtr /* user_data */);
19+
void* _Nullable /* user_data */);
2320

2421
/**
2522
* A primary responder of |FlutterKeyboardManager| that handles events by

0 commit comments

Comments
 (0)