1 //===-- ExampleClangProtoFuzzer.cpp - Fuzz Clang --------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// This file implements a function that runs Clang on a single
12 ///  input and uses libprotobuf-mutator to find new inputs. This function is
13 ///  then linked into the Fuzzer library.
14 ///
15 //===----------------------------------------------------------------------===//
16 
17 #include "cxx_proto.pb.h"
18 #include "handle-cxx/handle_cxx.h"
19 #include "proto-to-cxx/proto_to_cxx.h"
20 #include "fuzzer-initialize/fuzzer_initialize.h"
21 #include "src/libfuzzer/libfuzzer_macro.h"
22 
23 using namespace clang_fuzzer;
24 
25 DEFINE_BINARY_PROTO_FUZZER(const Function& input) {
26   auto S = FunctionToString(input);
27   HandleCXX(S, GetCLArgs());
28 }
29