[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / tools / clang-fuzzer / ExampleClangLLVMProtoFuzzer.cpp
blob2401299be1ec18f038db436dbaee8b29cb3e43e2
1 //===-- ExampleClangLLVMProtoFuzzer.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 compiles a single LLVM IR string as
11 /// input and uses libprotobuf-mutator to find new inputs. This function is
12 /// then linked into the Fuzzer library.
13 ///
14 //===----------------------------------------------------------------------===//
16 #include "cxx_loop_proto.pb.h"
17 #include "fuzzer-initialize/fuzzer_initialize.h"
18 #include "handle-llvm/handle_llvm.h"
19 #include "proto-to-llvm/loop_proto_to_llvm.h"
20 #include "src/libfuzzer/libfuzzer_macro.h"
22 using namespace clang_fuzzer;
24 DEFINE_BINARY_PROTO_FUZZER(const LoopFunction &input) {
25 auto S = LoopFunctionToLLVMString(input);
26 HandleLLVM(S, GetCLArgs());