/src/llvm-project/clang/tools/clang-fuzzer/ClangFuzzer.cpp
Line | Count | Source |
1 | | //===-- ClangFuzzer.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-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | /// |
9 | | /// \file |
10 | | /// This file implements a function that runs Clang on a single |
11 | | /// input. This function is then linked into the Fuzzer library. |
12 | | /// |
13 | | //===----------------------------------------------------------------------===// |
14 | | |
15 | | #include "handle-cxx/handle_cxx.h" |
16 | | |
17 | | using namespace clang_fuzzer; |
18 | | |
19 | 6 | extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; } |
20 | | |
21 | 51.2k | extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { |
22 | 51.2k | std::string s((const char *)data, size); |
23 | 51.2k | HandleCXX(s, "./test.cc", {"-O2"}); |
24 | 51.2k | return 0; |
25 | 51.2k | } |