Skip to content

Commit e4eb578

Browse files
style(iwyu): set up include cleaner of clang-tidy
This PR enables the `misc-include-cleaner` of `clang-tidy`, which enforces a version of include-what-you-use (IWYU), and applies all suggested fixes. Signed-off-by: Ingo Müller <ingomueller@google.com>
1 parent cc926e7 commit e4eb578

44 files changed

Lines changed: 239 additions & 38 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-tidy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Checks: >
5050
bugprone-*,
5151
google-*,
5252
modernize-*,
53+
misc-include-cleaner,
5354
performance-*,
5455
portability-*,
5556
readability-*,
@@ -108,3 +109,5 @@ CheckOptions:
108109
- { key: readability-implicit-bool-conversion.AllowIntegerConditions, value: 1 }
109110
- { key: readability-implicit-bool-conversion.AllowPointerConditions, value: 1 }
110111
- { key: readability-function-cognitive-complexity.IgnoreMacros, value: 1 }
112+
- { key: misc-include-cleaner.IgnoreHeaders
113+
value: bits/getopt_.*;getopt.h }

export/planloader/planloader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
#include "planloader.h"
44

5+
#include <substrait/proto/plan.pb.h>
6+
7+
#include <cstdint>
8+
#include <cstring>
59
#include <limits>
10+
#include <string>
611

712
#include "substrait/common/Io.h"
813

export/planloader/tests/PlanLoaderTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <gtest/gtest.h>
77
#include <substrait/proto/plan.pb.h>
88

9-
#include <functional>
9+
#include "substrait/common/Io.h"
1010

1111
namespace io::substrait::textplan {
1212
namespace {

src/substrait/common/Exceptions.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
#include "substrait/common/Exceptions.h"
44

5-
#include <fmt/format.h>
5+
#include <fmt/core.h>
6+
7+
#include <cstddef>
8+
#include <string>
69

710
namespace io::substrait::common {
811

src/substrait/common/Io.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#include "substrait/common/Io.h"
44

5+
#include <absl/status/status.h>
6+
#include <absl/status/statusor.h>
57
#include <substrait/proto/plan.pb.h>
68

79
#include <regex>

src/substrait/common/PlanTransformerTool.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/* SPDX-License-Identifier: Apache-2.0 */
22

3+
#include <algorithm>
4+
#include <cctype>
5+
#include <cstdio>
6+
#include <cstdlib>
37
#include <iostream>
8+
#include <string>
9+
#include <string_view>
410

511
#include "substrait/common/Io.h"
612

src/substrait/common/tests/IoTest.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
#include <gmock/gmock-matchers.h>
66
#include <gtest/gtest.h>
77
#include <protobuf-matchers/protocol-buffer-matchers.h>
8+
#include <substrait/proto/plan.pb.h>
89

910
#include <filesystem>
10-
11-
#ifndef _WIN32
12-
#include <unistd.h>
13-
#endif
11+
#include <string>
12+
#include <system_error>
1413

1514
using ::protobuf_matchers::EqualsProto;
1615
using ::protobuf_matchers::Partially;

src/substrait/expression/DecimalLiteral.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
#include <absl/strings/numbers.h>
77
#include <substrait/proto/algebra.pb.h>
88

9+
#include <cstddef>
10+
#include <cstdint>
11+
#include <cstring>
912
#include <sstream>
13+
#include <string>
1014

1115
namespace io::substrait::expression {
1216

src/substrait/expression/tests/DecimalTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
#include <gtest/gtest.h>
55
#include <substrait/proto/algebra.pb.h>
66

7+
#include <algorithm>
8+
#include <cstdint>
9+
#include <string>
10+
#include <vector>
11+
712
#include "substrait/expression/DecimalLiteral.h"
813

914
namespace io::substrait::expression {

src/substrait/function/Extension.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44

55
#include <yaml-cpp/yaml.h>
66

7+
#include <memory>
8+
#include <optional>
9+
#include <sstream>
10+
#include <string>
11+
#include <utility>
12+
#include <vector>
13+
14+
#include "substrait/function/Function.h"
15+
#include "substrait/type/Type.h"
16+
717
bool decodeFunctionImpl(
818
const YAML::Node& node,
919
io::substrait::FunctionImplementation& function) {

0 commit comments

Comments
 (0)