ClangObjectiveCFuzzer.cpp 860 B

123456789101112131415161718192021222324
  1. //===-- ClangObjectiveCFuzzer.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 Objective-C
  11. /// input. This function is then linked into the Fuzzer library.
  12. ///
  13. //===----------------------------------------------------------------------===//
  14. #include "handle-cxx/handle_cxx.h"
  15. using namespace clang_fuzzer;
  16. extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
  17. std::string s(reinterpret_cast<const char *>(data), size);
  18. HandleCXX(s, "./test.m", {"-O2"});
  19. return 0;
  20. }