82
82
using PostProcessorRegistration = \
83
83
protobuf_mutator::libfuzzer::PostProcessorRegistration<Proto>;
84
84
85
- #define DEFINE_PROTO_FUZZER_IMPL (use_binary, arg ) \
86
- static void TestOneProtoInput (arg); \
87
- using FuzzerProtoType = std::remove_const<std::remove_reference< \
88
- std::function<decltype (TestOneProtoInput)>::argument_type>::type>::type; \
89
- DEFINE_CUSTOM_PROTO_MUTATOR_IMPL (use_binary, FuzzerProtoType) \
90
- DEFINE_CUSTOM_PROTO_CROSSOVER_IMPL(use_binary, FuzzerProtoType) \
91
- DEFINE_TEST_ONE_PROTO_INPUT_IMPL(use_binary, FuzzerProtoType) \
92
- DEFINE_POST_PROCESS_PROTO_MUTATION_IMPL(FuzzerProtoType) \
85
+ #define DEFINE_PROTO_FUZZER_IMPL (use_binary, arg ) \
86
+ static void TestOneProtoInput (arg); \
87
+ using FuzzerProtoType = \
88
+ protobuf_mutator::libfuzzer::macro_internal::GetFirstParam< \
89
+ decltype (&TestOneProtoInput)>::type; \
90
+ DEFINE_CUSTOM_PROTO_MUTATOR_IMPL (use_binary, FuzzerProtoType) \
91
+ DEFINE_CUSTOM_PROTO_CROSSOVER_IMPL(use_binary, FuzzerProtoType) \
92
+ DEFINE_TEST_ONE_PROTO_INPUT_IMPL(use_binary, FuzzerProtoType) \
93
+ DEFINE_POST_PROCESS_PROTO_MUTATION_IMPL(FuzzerProtoType) \
93
94
static void TestOneProtoInput(arg)
94
95
95
96
namespace protobuf_mutator {
@@ -123,7 +124,20 @@ struct PostProcessorRegistration {
123
124
}
124
125
};
125
126
127
+ namespace macro_internal {
128
+
129
+ template <typename T>
130
+ struct GetFirstParam ;
131
+
132
+ template <class Arg >
133
+ struct GetFirstParam <void (*)(Arg)> {
134
+ using type = typename std::remove_const<
135
+ typename std::remove_reference<Arg>::type>::type;
136
+ };
137
+
138
+ } // namespace macro_internal
139
+
126
140
} // namespace libfuzzer
127
141
} // namespace protobuf_mutator
128
142
129
- #endif // SRC_LIBFUZZER_LIBFUZZER_MACRO_H_
143
+ #endif // SRC_LIBFUZZER_LIBFUZZER_MACRO_H_
0 commit comments