-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed as not planned
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: tech-debtTechnical debt, code quality, testing, etc.Technical debt, code quality, testing, etc.engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.team-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Description
clangd has a "preview mode" for a feature called "Include Cleaner":
Manually managing includes in a C++ translation unit, especially in the face of transitive inclusions, requires a lot of effort. Include Cleaner aims to provide diagnostics to keep includes in an IWYU-clean state.
// main.cpp #include "foo.h" #include "bar.h" // <- Will be marked as unused and suggested to be removed. int main() { Foo f; }
It can be enabled with a .clangd file at the root:
# .clangd
Diagnostics:
UnusedIncludes: Strict
MissingIncludes: Strict
To run these on CI, we can include the Clang Tidy check misc-include-cleaner:
Here are some files I spot-checked in the engine repo:
And here is an example of running clang-tidy --fix on dl_unittests.cc:
impeller/display_list/dl_unittests.cc
@@ -3,10 +3,18 @@
// found in the LICENSE file.
#include <array>
+#include <cassert>
#include <cmath>
+#include <cstddef>
+#include <cstdint>
#include <memory>
+#include <optional>
+#include <tuple>
#include <vector>
+#include "display_list/dl_canvas.h"
+#include "display_list/dl_sampling_options.h"
+#include "display_list/dl_vertices.h"
#include "flutter/display_list/display_list_builder.h"
#include "flutter/display_list/dl_blend_mode.h"
#include "flutter/display_list/dl_color.h"
@@ -16,24 +24,33 @@
#include "flutter/display_list/effects/dl_color_source.h"
#include "flutter/display_list/effects/dl_image_filter.h"
#include "flutter/display_list/effects/dl_mask_filter.h"
-#include "flutter/testing/testing.h"
+#include "gtest/gtest-param-test.h"
#include "gtest/gtest.h"
#include "impeller/display_list/dl_dispatcher.h"
#include "impeller/display_list/dl_image_impeller.h"
#include "impeller/display_list/dl_playground.h"
#include "impeller/entity/contents/solid_color_contents.h"
#include "impeller/entity/contents/solid_rrect_blur_contents.h"
+#include "impeller/entity/entity.h"
+#include "impeller/geometry/color.h"
#include "impeller/geometry/constants.h"
#include "impeller/geometry/point.h"
+#include "impeller/geometry/rect.h"
#include "impeller/geometry/scalar.h"
+#include "impeller/playground/playground_test.h"
#include "impeller/playground/widgets.h"
-#include "impeller/scene/node.h"
+#include "include/core/SkPath.h"
+#include "include/core/SkPath.h"
+#include "include/core/SkPathTypes.h"
+#include "include/core/SkPoint.h"
+#include "include/core/SkRect.h"
+#include "include/core/SkScalar.h"
+#include "include/core/SkTextBlob.h"
#include "third_party/imgui/imgui.h"
-#include "third_party/skia/include/core/SkBlurTypes.h"
-#include "third_party/skia/include/core/SkClipOp.h"
#include "third_party/skia/include/core/SkPathBuilder.h"
#include "third_party/skia/include/core/SkRRect.h"Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: tech-debtTechnical debt, code quality, testing, etc.Technical debt, code quality, testing, etc.engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.team-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team



