1 //===-- ExampleClangLLVMProtoFuzzer.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 compiles a single LLVM IR string as 12 /// input and uses libprotobuf-mutator to find new inputs. This function is 13 /// then linked into the Fuzzer library. 14 /// 15 //===----------------------------------------------------------------------===// 16 17 #include "cxx_loop_proto.pb.h" 18 #include "fuzzer-initialize/fuzzer_initialize.h" 19 #include "handle-llvm/handle_llvm.h" 20 #include "proto-to-llvm/loop_proto_to_llvm.h" 21 #include "src/libfuzzer/libfuzzer_macro.h" 22 23 using namespace clang_fuzzer; 24 25 DEFINE_BINARY_PROTO_FUZZER(const LoopFunction &input) { 26 auto S = LoopFunctionToLLVMString(input); 27 HandleLLVM(S, GetCLArgs()); 28 } 29