blob: 327d955f60a862aaa14cd752ef4e4b5a5b88e4e2 [file] [log] [blame]
Manuel Klimek667c1522015-03-28 00:07:39 +00001//===-- ClangFuzzer.cpp - Fuzz Clang --------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9///
10/// \file
11/// \brief This file implements a function that runs Clang on a single
12/// input. This function is then linked into the Fuzzer library.
13///
14//===----------------------------------------------------------------------===//
15
Matt Morehousef051f5d2017-08-08 20:15:04 +000016#include "handle-cxx/handle_cxx.h"
Manuel Klimek667c1522015-03-28 00:07:39 +000017
Matt Morehousef051f5d2017-08-08 20:15:04 +000018using namespace clang_fuzzer;
Manuel Klimek667c1522015-03-28 00:07:39 +000019
Kostya Serebryanye39fec52015-10-02 23:34:37 +000020extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
Manuel Klimek667c1522015-03-28 00:07:39 +000021 std::string s((const char *)data, size);
Matt Morehousef051f5d2017-08-08 20:15:04 +000022 HandleCXX(s, {"-O2"});
Kostya Serebryanye39fec52015-10-02 23:34:37 +000023 return 0;
Manuel Klimek667c1522015-03-28 00:07:39 +000024}