1 //===-- ExampleClangLoopProtoFuzzer.cpp - Fuzz Clang ----------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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. This file differs from
14 /// ExampleClangProtoFuzzer in that it uses a different protobuf that includes
15 /// C++ code with a single for loop.
17 //===----------------------------------------------------------------------===//
19 #include "cxx_loop_proto.pb.h"
20 #include "fuzzer-initialize/fuzzer_initialize.h"
21 #include "handle-cxx/handle_cxx.h"
22 #include "proto-to-cxx/proto_to_cxx.h"
23 #include "src/libfuzzer/libfuzzer_macro.h"
25 using namespace clang_fuzzer;
27 DEFINE_BINARY_PROTO_FUZZER(const LoopFunction &input) {
28 auto S = LoopFunctionToString(input);
29 HandleCXX(S, GetCLArgs());