OLD | NEW |
1 //===---- llvm/IRReader/IRReader.h - Reader for LLVM IR files ---*- C++ -*-===// | 1 //===---- llvm/IRReader/IRReader.h - Reader for LLVM IR files ---*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file defines functions for reading LLVM IR. They support both | 10 // This file defines functions for reading LLVM IR. They support both |
(...skipping 25 matching lines...) Expand all Loading... |
36 /// a Module for it. This function *never* takes ownership of Buffer. | 36 /// a Module for it. This function *never* takes ownership of Buffer. |
37 Module *ParseIR(MemoryBuffer *Buffer, SMDiagnostic &Err, LLVMContext &Context); | 37 Module *ParseIR(MemoryBuffer *Buffer, SMDiagnostic &Err, LLVMContext &Context); |
38 | 38 |
39 /// If the given file holds a bitcode image, return a Module for it. | 39 /// If the given file holds a bitcode image, return a Module for it. |
40 /// Otherwise, attempt to parse it as LLVM Assembly and return a Module | 40 /// Otherwise, attempt to parse it as LLVM Assembly and return a Module |
41 /// for it. | 41 /// for it. |
42 Module *ParseIRFile(const std::string &Filename, SMDiagnostic &Err, | 42 Module *ParseIRFile(const std::string &Filename, SMDiagnostic &Err, |
43 LLVMContext &Context); | 43 LLVMContext &Context); |
44 | 44 |
45 // @LOCALMOD-BEGIN | 45 // @LOCALMOD-BEGIN |
| 46 class raw_ostream; |
| 47 |
46 // \brief Define the expected format of the file. | 48 // \brief Define the expected format of the file. |
47 enum NaClFileFormat { | 49 enum NaClFileFormat { |
48 // LLVM IR source or bitcode file (as appropriate). | 50 // LLVM IR source or bitcode file (as appropriate). |
49 LLVMFormat, | 51 LLVMFormat, |
50 // PNaCl bitcode file. | 52 // PNaCl bitcode file. |
51 PNaClFormat | 53 PNaClFormat |
52 }; | 54 }; |
53 | 55 |
54 // \brief If the given MemoryBuffer holds a bitcode image, return a Module | 56 // \brief If the given MemoryBuffer holds a bitcode image, return a |
55 // for it. Otherwise, attempt to parse it as LLVM Assembly and return | 57 // Module for it. Otherwise, attempt to parse it as LLVM Assembly and |
56 // a Module for it. This function *always* takes ownership of the given | 58 // return a Module for it. This function *always* takes ownership of |
57 // MemoryBuffer. | 59 // the given MemoryBuffer. When Format=PNaClFormat and Verbose |
| 60 // is non-null, more descriptive error messages are also written to |
| 61 // Verbose. |
58 Module *NaClParseIR(MemoryBuffer *Buffer, | 62 Module *NaClParseIR(MemoryBuffer *Buffer, |
59 NaClFileFormat Format, | 63 NaClFileFormat Format, |
60 SMDiagnostic &Err, | 64 SMDiagnostic &Err, |
| 65 raw_ostream *Verbose, |
61 LLVMContext &Context); | 66 LLVMContext &Context); |
62 | 67 |
63 /// \brief If the given file holds a Bitcode image, read the file. | 68 /// \brief If the given file holds a Bitcode image, read the file. |
64 /// Otherwise, attempt to parse it as LLVM assembly and return a | 69 /// Otherwise, attempt to parse it as LLVM assembly and return a |
65 /// Module for it. | 70 /// Module for it. When Format=PNaClFormat and Verbose |
| 71 // is non-null, more descriptive error messages are also written to |
| 72 // Verbose. |
66 Module *NaClParseIRFile(const std::string &Filename, | 73 Module *NaClParseIRFile(const std::string &Filename, |
67 NaClFileFormat Format, | 74 NaClFileFormat Format, |
68 SMDiagnostic &Err, | 75 SMDiagnostic &Err, |
| 76 raw_ostream *Verbose, |
69 LLVMContext &Context); | 77 LLVMContext &Context); |
70 // @LOCALMOD-END | 78 // @LOCALMOD-END |
71 } | 79 } |
72 | 80 |
73 #endif | 81 #endif |
OLD | NEW |