1 //==-- loop_proto_to_cxx_main.cpp - Driver for protobuf-C++ conversion -----==// 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 // Implements a simple driver to print a C++ program from a protobuf with loops. 11 // 12 //===----------------------------------------------------------------------===// 13 14 // This is a copy and will be updated later to introduce changes 15 16 #include <fstream> 17 #include <iostream> 18 #include <streambuf> 19 #include <string> 20 21 #include "proto_to_cxx.h" 22 23 int main(int argc, char **argv) { 24 for (int i = 1; i < argc; i++) { 25 std::fstream in(argv[i]); 26 std::string str((std::istreambuf_iterator<char>(in)), 27 std::istreambuf_iterator<char>()); 28 std::cout << "// " << argv[i] << std::endl; 29 std::cout << clang_fuzzer::LoopProtoToCxx( 30 reinterpret_cast<const uint8_t *>(str.data()), str.size()); 31 } 32 } 33