1 //===-- ExampleClangProtoFuzzer.cpp - Fuzz Clang --------------------------===// 2 // 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 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. 13 /// 14 //===----------------------------------------------------------------------===// 15 16 #include "cxx_proto.pb.h" 17 #include "handle-cxx/handle_cxx.h" 18 #include "proto-to-cxx/proto_to_cxx.h" 19 #include "fuzzer-initialize/fuzzer_initialize.h" 20 #include "src/libfuzzer/libfuzzer_macro.h" 21 22 using namespace clang_fuzzer; 23 DEFINE_BINARY_PROTO_FUZZER(const Function & input)24DEFINE_BINARY_PROTO_FUZZER(const Function& input) { 25 auto S = FunctionToString(input); 26 HandleCXX(S, "./test.cc", GetCLArgs()); 27 } 28