1*e5dd7070Spatrick //===-- ExampleClangProtoFuzzer.cpp - Fuzz Clang --------------------------===// 2*e5dd7070Spatrick // 3*e5dd7070Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*e5dd7070Spatrick // See https://llvm.org/LICENSE.txt for license information. 5*e5dd7070Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*e5dd7070Spatrick // 7*e5dd7070Spatrick //===----------------------------------------------------------------------===// 8*e5dd7070Spatrick /// 9*e5dd7070Spatrick /// \file 10*e5dd7070Spatrick /// This file implements a function that runs Clang on a single 11*e5dd7070Spatrick /// input and uses libprotobuf-mutator to find new inputs. This function is 12*e5dd7070Spatrick /// then linked into the Fuzzer library. 13*e5dd7070Spatrick /// 14*e5dd7070Spatrick //===----------------------------------------------------------------------===// 15*e5dd7070Spatrick 16*e5dd7070Spatrick #include "cxx_proto.pb.h" 17*e5dd7070Spatrick #include "handle-cxx/handle_cxx.h" 18*e5dd7070Spatrick #include "proto-to-cxx/proto_to_cxx.h" 19*e5dd7070Spatrick #include "fuzzer-initialize/fuzzer_initialize.h" 20*e5dd7070Spatrick #include "src/libfuzzer/libfuzzer_macro.h" 21*e5dd7070Spatrick 22*e5dd7070Spatrick using namespace clang_fuzzer; 23*e5dd7070Spatrick DEFINE_BINARY_PROTO_FUZZER(const Function & input)24*e5dd7070SpatrickDEFINE_BINARY_PROTO_FUZZER(const Function& input) { 25*e5dd7070Spatrick auto S = FunctionToString(input); 26*e5dd7070Spatrick HandleCXX(S, "./test.cc", GetCLArgs()); 27*e5dd7070Spatrick } 28