2017-08-09 04:15:04 +08:00
|
|
|
//===-- ExampleClangProtoFuzzer.cpp - Fuzz Clang --------------------------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2017-08-09 04:15:04 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file
|
2018-05-09 09:00:01 +08:00
|
|
|
/// This file implements a function that runs Clang on a single
|
2017-08-09 04:15:04 +08:00
|
|
|
/// input and uses libprotobuf-mutator to find new inputs. This function is
|
|
|
|
/// then linked into the Fuzzer library.
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "cxx_proto.pb.h"
|
|
|
|
#include "handle-cxx/handle_cxx.h"
|
|
|
|
#include "proto-to-cxx/proto_to_cxx.h"
|
2018-06-05 08:11:41 +08:00
|
|
|
#include "fuzzer-initialize/fuzzer_initialize.h"
|
2017-08-09 04:15:04 +08:00
|
|
|
#include "src/libfuzzer/libfuzzer_macro.h"
|
|
|
|
|
|
|
|
using namespace clang_fuzzer;
|
|
|
|
|
|
|
|
DEFINE_BINARY_PROTO_FUZZER(const Function& input) {
|
|
|
|
auto S = FunctionToString(input);
|
2019-10-22 15:51:37 +08:00
|
|
|
HandleCXX(S, "./test.cc", GetCLArgs());
|
2017-08-09 04:15:04 +08:00
|
|
|
}
|