From 24dec80b44b5980f348e99b410893fb139836965 Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Wed, 31 May 2017 16:44:41 +0200 Subject: [PATCH] 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. --- include/pybind11/numpy.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 1e12ede19..388e21229 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -1147,6 +1147,11 @@ private: } }; +#ifdef __CLION_IDE__ // replace heavy macro with dummy code for the IDE (doesn't affect code) +# define PYBIND11_NUMPY_DTYPE(Type, ...) ((void)0) +# define PYBIND11_NUMPY_DTYPE_EX(Type, ...) ((void)0) +#else + #define PYBIND11_FIELD_DESCRIPTOR_EX(T, Field, Name) \ ::pybind11::detail::field_descriptor { \ Name, offsetof(T, Field), sizeof(decltype(std::declval().Field)), \ @@ -1214,6 +1219,8 @@ private: ::pybind11::detail::npy_format_descriptor::register_dtype \ ({PYBIND11_MAP2_LIST (PYBIND11_FIELD_DESCRIPTOR_EX, Type, __VA_ARGS__)}) +#endif // __CLION_IDE__ + template using array_iterator = typename std::add_pointer::type;