blob: a9a03f1f46edb94302d67feebcc188a58cc6867a [file] [log] [blame]
Vitaly Buka410a6b22018-06-07 19:17:46 +00001//===-- ExampleClangLoopProtoFuzzer.cpp - Fuzz Clang ----------------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Vitaly Buka410a6b22018-06-07 19:17:46 +00006//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file implements a function that runs Clang on a single
11/// input and uses libprotobuf-mutator to find new inputs. This function is
12/// then linked into the Fuzzer library. This file differs from
Emmett Neyman07605cb2018-06-21 22:08:20 +000013/// ExampleClangProtoFuzzer in that it uses a different protobuf that includes
Vitaly Buka410a6b22018-06-07 19:17:46 +000014/// C++ code with a single for loop.
15///
16//===----------------------------------------------------------------------===//
17
18#include "cxx_loop_proto.pb.h"
19#include "fuzzer-initialize/fuzzer_initialize.h"
20#include "handle-cxx/handle_cxx.h"
21#include "proto-to-cxx/proto_to_cxx.h"
22#include "src/libfuzzer/libfuzzer_macro.h"
23
24using namespace clang_fuzzer;
25
26DEFINE_BINARY_PROTO_FUZZER(const LoopFunction &input) {
27 auto S = LoopFunctionToString(input);
28 HandleCXX(S, GetCLArgs());
29}