]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/clang-fuzzer/ExampleClangLoopProtoFuzzer.cpp
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / tools / clang-fuzzer / ExampleClangLoopProtoFuzzer.cpp
1 //===-- 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
14 ///  ExampleClangProtoFuzzer in that it uses a different protobuf that includes
15 ///  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
25 using namespace clang_fuzzer;
26
27 DEFINE_BINARY_PROTO_FUZZER(const LoopFunction &input) {
28   auto S = LoopFunctionToString(input);
29   HandleCXX(S, GetCLArgs());
30 }