File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
include/llvm-dialects/Dialect Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,20 @@ struct VisitorPayloadProjection {
9191 static constexpr std::size_t offset = offsetof(PayloadT, field); \
9292 };
9393
94+ // / Identical to the previous macro except this one handles complex data types
95+ // /
96+ // / offsetof() should not be used with complex types that have a non-standard
97+ // / layout, such as classes. Here we set useOffsetof = false to avoid using
98+ // / offsetof() on the field.
99+ #define LLVM_DIALECTS_VISITOR_PAYLOAD_PROJECT_COMPLEX_FIELD (PayloadT, field ) \
100+ template <> \
101+ struct llvm_dialects ::detail::VisitorPayloadOffsetProjection< \
102+ PayloadT, \
103+ std::remove_reference_t <decltype (std::declval<PayloadT>().field)>> { \
104+ static constexpr bool useOffsetof = false ; \
105+ static constexpr std::size_t offset = 0 ; \
106+ };
107+
94108// / @brief Possible result states of visitor callbacks
95109// /
96110// / A visitor may have multiple callbacks registered that match on the same
You can’t perform that action at this time.
0 commit comments