Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 1 | //===-- ExampleClangLoopProtoFuzzer.cpp - Fuzz Clang ----------------------===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // 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 Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 6 | // |
| 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 Neyman | 07605cb | 2018-06-21 22:08:20 +0000 | [diff] [blame] | 13 | /// ExampleClangProtoFuzzer in that it uses a different protobuf that includes |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 14 | /// 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 | |
| 24 | using namespace clang_fuzzer; |
| 25 | |
| 26 | DEFINE_BINARY_PROTO_FUZZER(const LoopFunction &input) { |
| 27 | auto S = LoopFunctionToString(input); |
| 28 | HandleCXX(S, GetCLArgs()); |
| 29 | } |