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

Commit 5293864

Browse files
authored
Enable bugprone-unchecked-optional-access, disable in files with warnings (#42359)
First part of flutter/flutter#127701
1 parent 24889bc commit 5293864

37 files changed

+177
-0
lines changed

.ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ targets:
278278
runIf:
279279
- DEPS
280280
- .ci.yaml
281+
- .clang-tidy
281282
- tools/**
282283
- ci/**
283284
- "**.h"
@@ -298,6 +299,7 @@ targets:
298299
runIf:
299300
- DEPS
300301
- .ci.yaml
302+
- .clang-tidy
301303
- tools/**
302304
- ci/**
303305
- "**.h"
@@ -541,6 +543,7 @@ targets:
541543
runIf:
542544
- DEPS
543545
- .ci.yaml
546+
- .clang-tidy
544547
- tools/**
545548
- ci/**
546549
- "**.h"
@@ -563,6 +566,7 @@ targets:
563566
runIf:
564567
- DEPS
565568
- .ci.yaml
569+
- .clang-tidy
566570
- tools/**
567571
- ci/**
568572
- "**.h"

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Note: Some of the checks here are used as errors selectively, see
33
# //ci/lint.sh
44
Checks: "bugprone-use-after-move,\
5+
bugprone-unchecked-optional-access,\
56
clang-analyzer-*,\
67
clang-diagnostic-*,\
78
darwin-*,\

flow/layers/clip_path_layer_unittests.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include "flutter/fml/macros.h"
1515
#include "gtest/gtest.h"
1616

17+
// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
18+
// NOLINTBEGIN(bugprone-unchecked-optional-access)
19+
1720
namespace flutter {
1821
namespace testing {
1922

@@ -569,3 +572,5 @@ TEST_F(ClipPathLayerTest, EmptyClipDoesNotCullPlatformView) {
569572

570573
} // namespace testing
571574
} // namespace flutter
575+
576+
// NOLINTEND(bugprone-unchecked-optional-access)

flow/layers/clip_rect_layer_unittests.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#include "flutter/flow/testing/mock_layer.h"
1313
#include "flutter/fml/macros.h"
1414

15+
// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
16+
// NOLINTBEGIN(bugprone-unchecked-optional-access)
17+
1518
namespace flutter {
1619
namespace testing {
1720

@@ -545,3 +548,5 @@ TEST_F(ClipRectLayerTest, EmptyClipDoesNotCullPlatformView) {
545548

546549
} // namespace testing
547550
} // namespace flutter
551+
552+
// NOLINTEND(bugprone-unchecked-optional-access)

flow/layers/clip_rrect_layer_unittests.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#include "flutter/flow/testing/mock_layer.h"
1313
#include "flutter/fml/macros.h"
1414

15+
// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
16+
// NOLINTBEGIN(bugprone-unchecked-optional-access)
17+
1518
namespace flutter {
1619
namespace testing {
1720

@@ -594,3 +597,5 @@ TEST_F(ClipRRectLayerTest, EmptyClipDoesNotCullPlatformView) {
594597

595598
} // namespace testing
596599
} // namespace flutter
600+
601+
// NOLINTEND(bugprone-unchecked-optional-access)

flow/layers/color_filter_layer_unittests.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#include "flutter/flow/testing/mock_layer.h"
1818
#include "flutter/fml/macros.h"
1919

20+
// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
21+
// NOLINTBEGIN(bugprone-unchecked-optional-access)
22+
2023
namespace flutter {
2124
namespace testing {
2225

@@ -454,3 +457,5 @@ TEST_F(ColorFilterLayerTest, OpacityInheritance) {
454457

455458
} // namespace testing
456459
} // namespace flutter
460+
461+
// NOLINTEND(bugprone-unchecked-optional-access)

flow/layers/container_layer_unittests.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#include "gtest/gtest.h"
1414
#include "include/core/SkMatrix.h"
1515

16+
// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
17+
// NOLINTBEGIN(bugprone-unchecked-optional-access)
18+
1619
namespace flutter {
1720
namespace testing {
1821

@@ -762,3 +765,5 @@ TEST_F(ContainerLayerDiffTest, ReplaceLayer) {
762765

763766
} // namespace testing
764767
} // namespace flutter
768+
769+
// NOLINTEND(bugprone-unchecked-optional-access)

flow/layers/display_list_layer_unittests.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#include "flutter/flow/testing/diff_context_test.h"
1212
#include "flutter/fml/macros.h"
1313

14+
// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
15+
// NOLINTBEGIN(bugprone-unchecked-optional-access)
16+
1417
namespace flutter {
1518
namespace testing {
1619

@@ -570,3 +573,5 @@ TEST_F(DisplayListLayerTest, OverflowCachedDisplayListOpacityInheritance) {
570573

571574
} // namespace testing
572575
} // namespace flutter
576+
577+
// NOLINTEND(bugprone-unchecked-optional-access)

flow/layers/display_list_raster_cache_item.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#include "flutter/flow/raster_cache_util.h"
1717
#include "third_party/skia/include/gpu/GrDirectContext.h"
1818

19+
// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
20+
// NOLINTBEGIN(bugprone-unchecked-optional-access)
21+
1922
namespace flutter {
2023

2124
static bool IsDisplayListWorthRasterizing(
@@ -170,3 +173,5 @@ bool DisplayListRasterCacheItem::TryToPrepareRasterCache(
170173
});
171174
}
172175
} // namespace flutter
176+
177+
// NOLINTEND(bugprone-unchecked-optional-access)

flow/layers/image_filter_layer_unittests.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
#include "include/core/SkPath.h"
1616
#include "third_party/skia/include/effects/SkImageFilters.h"
1717

18+
// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
19+
// NOLINTBEGIN(bugprone-unchecked-optional-access)
20+
1821
namespace flutter {
1922
namespace testing {
2023

@@ -710,3 +713,5 @@ TEST_F(ImageFilterLayerDiffTest, ImageFilterLayerInflatestChildSize) {
710713

711714
} // namespace testing
712715
} // namespace flutter
716+
717+
// NOLINTEND(bugprone-unchecked-optional-access)

0 commit comments

Comments
 (0)