Skip to content

Commit 24dec80

Browse files
committed
Help CLion IDE evaluate PYBIND11_NUMPY_DTYPE
CLion slows to a crawl when evaluating the intricate `PYBIND11_NUMPY_DTYPE` macro. This commit replaces the macro cascade with a simple `(void)0` to ease IDE evaluation.
1 parent e067c58 commit 24dec80

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/pybind11/numpy.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,11 @@ template <typename T, typename SFINAE> struct npy_format_descriptor {
11471147
}
11481148
};
11491149

1150+
#ifdef __CLION_IDE__ // replace heavy macro with dummy code for the IDE (doesn't affect code)
1151+
# define PYBIND11_NUMPY_DTYPE(Type, ...) ((void)0)
1152+
# define PYBIND11_NUMPY_DTYPE_EX(Type, ...) ((void)0)
1153+
#else
1154+
11501155
#define PYBIND11_FIELD_DESCRIPTOR_EX(T, Field, Name) \
11511156
::pybind11::detail::field_descriptor { \
11521157
Name, offsetof(T, Field), sizeof(decltype(std::declval<T>().Field)), \
@@ -1214,6 +1219,8 @@ template <typename T, typename SFINAE> struct npy_format_descriptor {
12141219
::pybind11::detail::npy_format_descriptor<Type>::register_dtype \
12151220
({PYBIND11_MAP2_LIST (PYBIND11_FIELD_DESCRIPTOR_EX, Type, __VA_ARGS__)})
12161221

1222+
#endif // __CLION_IDE__
1223+
12171224
template <class T>
12181225
using array_iterator = typename std::add_pointer<T>::type;
12191226

0 commit comments

Comments
 (0)