blob: 3640be13fafd1be29fb956fbd431553283025cbc [file] [log] [blame]
Vitaly Buka410a6b22018-06-07 19:17:46 +00001//===-- ExampleClangLoopProtoFuzzer.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. This file differs from
Emmett Neyman07605cb2018-06-21 22:08:20 +000014/// ExampleClangProtoFuzzer in that it uses a different protobuf that includes
Vitaly Buka410a6b22018-06-07 19:17:46 +000015/// C++ code with a single for loop.
16///
17//===----------------------------------------------------------------------===//
18
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"
24
25using namespace clang_fuzzer;
26
27DEFINE_BINARY_PROTO_FUZZER(const LoopFunction &input) {
28 auto S = LoopFunctionToString(input);
29 HandleCXX(S, GetCLArgs());
30}