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 15 #include <fstream> 16 #include <iostream> 17 #include <streambuf> 18 #include <string> 19 20 #include "proto_to_cxx.h" 21 22 int main(int argc, char **argv) { 23 for (int i = 1; i < argc; i++) { 24 std::fstream in(argv[i]); 25 std::string str((std::istreambuf_iterator<char>(in)), 26 std::istreambuf_iterator<char>()); 27 std::cout << "// " << argv[i] << std::endl; 28 std::cout << clang_fuzzer::LoopProtoToCxx( 29 reinterpret_cast<const uint8_t *>(str.data()), str.size()); 30 } 31 } 32