LCOV - code coverage report
Current view: top level - lib/Bitcode/Writer - BitWriter.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 0 15 0.0 %
Date: 2018-10-20 13:21:21 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- BitWriter.cpp -----------------------------------------------------===//
       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             : #include "llvm-c/BitWriter.h"
      11             : #include "llvm/Bitcode/BitcodeWriter.h"
      12             : #include "llvm/IR/Module.h"
      13             : #include "llvm/Support/FileSystem.h"
      14             : #include "llvm/Support/MemoryBuffer.h"
      15             : #include "llvm/Support/raw_ostream.h"
      16             : using namespace llvm;
      17             : 
      18             : 
      19             : /*===-- Operations on modules ---------------------------------------------===*/
      20             : 
      21           0 : int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) {
      22             :   std::error_code EC;
      23           0 :   raw_fd_ostream OS(Path, EC, sys::fs::F_None);
      24             : 
      25           0 :   if (EC)
      26             :     return -1;
      27             : 
      28           0 :   WriteBitcodeToFile(*unwrap(M), OS);
      29           0 :   return 0;
      30             : }
      31             : 
      32           0 : int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
      33             :                          int Unbuffered) {
      34           0 :   raw_fd_ostream OS(FD, ShouldClose, Unbuffered);
      35             : 
      36           0 :   WriteBitcodeToFile(*unwrap(M), OS);
      37           0 :   return 0;
      38             : }
      39             : 
      40           0 : int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int FileHandle) {
      41           0 :   return LLVMWriteBitcodeToFD(M, FileHandle, true, false);
      42             : }
      43             : 
      44           0 : LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M) {
      45             :   std::string Data;
      46           0 :   raw_string_ostream OS(Data);
      47             : 
      48           0 :   WriteBitcodeToFile(*unwrap(M), OS);
      49           0 :   return wrap(MemoryBuffer::getMemBufferCopy(OS.str()).release());
      50             : }

Generated by: LCOV version 1.13