brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · a9a03f1 Raw
30 lines · cpp
1//===-- ExampleClangLoopProtoFuzzer.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-exception6//7//===----------------------------------------------------------------------===//8///9/// \file10///  This file implements a function that runs Clang on a single11///  input and uses libprotobuf-mutator to find new inputs. This function is12///  then linked into the Fuzzer library. This file differs from13///  ExampleClangProtoFuzzer in that it uses a different protobuf that includes14///  C++ code with a single for loop.15///16//===----------------------------------------------------------------------===//17 18#include "cxx_loop_proto.pb.h"19#include "fuzzer-initialize/fuzzer_initialize.h"20#include "handle-cxx/handle_cxx.h"21#include "proto-to-cxx/proto_to_cxx.h"22#include "src/libfuzzer/libfuzzer_macro.h"23 24using namespace clang_fuzzer;25 26DEFINE_BINARY_PROTO_FUZZER(const LoopFunction &input) {27  auto S = LoopFunctionToString(input);28  HandleCXX(S, GetCLArgs());29}30