Debian Codegraph @

llvm-project/clang/tools/clang-fuzzer/proto-to-llvm/loop_proto_to_llvm_main.cpp

raw
1 //==-- loop_proto_to_llvm_main.cpp - Driver for protobuf-LLVM conversion----==//
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 // Implements a simple driver to print a LLVM program from a protobuf with loops
10 //
11 //===----------------------------------------------------------------------===//
12
13
14 #include <fstream>
15 #include <iostream>
16 #include <streambuf>
17 #include <string>
18
19 #include "loop_proto_to_llvm.h"
20
21 int main(int argc, char **argv) {
22 for (int i = 1; i < argc; i++) {
23 std::fstream in(argv[i]);
24 std::string str((std::istreambuf_iterator<char>(in)),
25 std::istreambuf_iterator<char>());
26 std::cout << ";; " << argv[i] << std::endl;
27 std::cout << clang_fuzzer::LoopProtoToLLVM(
28 reinterpret_cast<const uint8_t *>(str.data()), str.size());
29 }
30 }