blob: 651f5c99a883a5b89d01b2246f0f7caaa94f9357 [file] [log] [blame]
Matt Morehousef051f5d2017-08-08 20:15:04 +00001//===-- ExampleClangProtoFuzzer.cpp - Fuzz Clang --------------------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Matt Morehousef051f5d2017-08-08 20:15:04 +00006//
7//===----------------------------------------------------------------------===//
8///
9/// \file
Adrian Prantl9fc8faf2018-05-09 01:00:01 +000010/// This file implements a function that runs Clang on a single
Matt Morehousef051f5d2017-08-08 20:15:04 +000011/// 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"
Matt Morehouse293c2692018-06-05 00:11:41 +000019#include "fuzzer-initialize/fuzzer_initialize.h"
Matt Morehousef051f5d2017-08-08 20:15:04 +000020#include "src/libfuzzer/libfuzzer_macro.h"
21
22using namespace clang_fuzzer;
23
24DEFINE_BINARY_PROTO_FUZZER(const Function& input) {
25 auto S = FunctionToString(input);
Matt Morehouse293c2692018-06-05 00:11:41 +000026 HandleCXX(S, GetCLArgs());
Matt Morehousef051f5d2017-08-08 20:15:04 +000027}