1e5f4a9ffSEmmett Neyman //===-- ExampleClangLLVMProtoFuzzer.cpp - Fuzz Clang ----------------------===// 2e5f4a9ffSEmmett Neyman // 3*2946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*2946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 5*2946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6e5f4a9ffSEmmett Neyman // 7e5f4a9ffSEmmett Neyman //===----------------------------------------------------------------------===// 8e5f4a9ffSEmmett Neyman /// 9e5f4a9ffSEmmett Neyman /// \file 10e5f4a9ffSEmmett Neyman /// This file implements a function that compiles a single LLVM IR string as 11e5f4a9ffSEmmett Neyman /// input and uses libprotobuf-mutator to find new inputs. This function is 12e5f4a9ffSEmmett Neyman /// then linked into the Fuzzer library. 13e5f4a9ffSEmmett Neyman /// 14e5f4a9ffSEmmett Neyman //===----------------------------------------------------------------------===// 15e5f4a9ffSEmmett Neyman 16e5f4a9ffSEmmett Neyman #include "cxx_loop_proto.pb.h" 17e5f4a9ffSEmmett Neyman #include "fuzzer-initialize/fuzzer_initialize.h" 18e5f4a9ffSEmmett Neyman #include "handle-llvm/handle_llvm.h" 19e5f4a9ffSEmmett Neyman #include "proto-to-llvm/loop_proto_to_llvm.h" 20e5f4a9ffSEmmett Neyman #include "src/libfuzzer/libfuzzer_macro.h" 21e5f4a9ffSEmmett Neyman 22e5f4a9ffSEmmett Neyman using namespace clang_fuzzer; 23e5f4a9ffSEmmett Neyman DEFINE_BINARY_PROTO_FUZZER(const LoopFunction & input)24e5f4a9ffSEmmett NeymanDEFINE_BINARY_PROTO_FUZZER(const LoopFunction &input) { 25e5f4a9ffSEmmett Neyman auto S = LoopFunctionToLLVMString(input); 26e5f4a9ffSEmmett Neyman HandleLLVM(S, GetCLArgs()); 27e5f4a9ffSEmmett Neyman } 28