Skip to content

Commit 33b4dbd

Browse files
rwgkcopybara-github
authored andcommitted
Add pybind11 IWYU pragmas (for clangd Include Cleaner).
Adopt the ``` // IWYU pragma: always_keep // See pybind11/docs/type_caster_iwyu.rst ``` comment used in google/pybind11clif#30073. Currently pybind11/docs/type_caster_iwyu.rst only exists in google/pybind11clif#30073, but the intend is to upstream the changes (see PR description). See also: https://clangd.llvm.org/design/include-cleaner PiperOrigin-RevId: 578318836
1 parent 24a1111 commit 33b4dbd

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

pybind11_protobuf/enum_type_caster.h

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// IWYU pragma: always_keep // Appears to be the best we can do at the moment.
2+
// What we really want (but does not work with Include Cleaner @ 2023-10-27):
3+
// * If native_proto_caster.h is included: suggest removing enum_type_caster.h
4+
// * If only enum_type_caster.h is included: always_keep
5+
16
#ifndef PYBIND11_PROTOBUF_ENUM_TYPE_CASTER_H_
27
#define PYBIND11_PROTOBUF_ENUM_TYPE_CASTER_H_
38

pybind11_protobuf/native_proto_caster.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// IWYU pragma: always_keep // See pybind11/docs/type_caster_iwyu.rst
2+
13
#ifndef PYBIND11_PROTOBUF_NATIVE_PROTO_CASTERS_H_
24
#define PYBIND11_PROTOBUF_NATIVE_PROTO_CASTERS_H_
35

pybind11_protobuf/proto_cast_util.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// IWYU pragma: private, include "pybind11_protobuf/native_proto_caster.h"
2+
13
#ifndef PYBIND11_PROTOBUF_PROTO_CAST_UTIL_H_
24
#define PYBIND11_PROTOBUF_PROTO_CAST_UTIL_H_
35

pybind11_protobuf/proto_caster_impl.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// IWYU pragma: private, include "pybind11_protobuf/native_proto_caster.h"
2+
13
#ifndef PYBIND11_PROTOBUF_PROTO_CASTER_IMPL_H_
24
#define PYBIND11_PROTOBUF_PROTO_CASTER_IMPL_H_
35

pybind11_protobuf/wrapped_proto_caster.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// IWYU pragma: always_keep // See pybind11/docs/type_caster_iwyu.rst
2+
13
#ifndef PYBIND11_PROTOBUF_WRAPPED_PROTO_CASTER_H_
24
#define PYBIND11_PROTOBUF_WRAPPED_PROTO_CASTER_H_
35

0 commit comments

Comments
 (0)