]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/clang-fuzzer/ClangFuzzer.cpp
Vendor import of clang trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / tools / clang-fuzzer / ClangFuzzer.cpp
1 //===-- 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 /// 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
16 #include "handle-cxx/handle_cxx.h"
17
18 using namespace clang_fuzzer;
19
20 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; }
21
22 extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
23   std::string s((const char *)data, size);
24   HandleCXX(s, {"-O2"});
25   return 0;
26 }