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 |
11 // Bitcode and Assembly, automatically detecting the input format. | 11 // Bitcode and Assembly, automatically detecting the input format. |
12 // | 12 // |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
15 #ifndef LLVM_IRREADER_IRREADER_H | 15 #ifndef LLVM_IRREADER_IRREADER_H |
16 #define LLVM_IRREADER_IRREADER_H | 16 #define LLVM_IRREADER_IRREADER_H |
17 | 17 |
| 18 #include "llvm/IR/DiagnosticInfo.h" |
18 #include "llvm/Support/MemoryBuffer.h" | 19 #include "llvm/Support/MemoryBuffer.h" |
19 #include <string> | 20 #include <string> |
20 | 21 |
21 namespace llvm { | 22 namespace llvm { |
22 | 23 |
23 class Module; | 24 class Module; |
24 class SMDiagnostic; | 25 class SMDiagnostic; |
25 class LLVMContext; | 26 class LLVMContext; |
26 | 27 |
27 /// If the given file holds a bitcode image, return a Module | 28 /// If the given file holds a bitcode image, return a Module |
(...skipping 24 matching lines...) Expand all Loading... |
52 // LLVM IR source or bitcode file (as appropriate). | 53 // LLVM IR source or bitcode file (as appropriate). |
53 LLVMFormat, | 54 LLVMFormat, |
54 // PNaCl bitcode file. | 55 // PNaCl bitcode file. |
55 PNaClFormat, | 56 PNaClFormat, |
56 // Autodetect if PNaCl or LLVM format. | 57 // Autodetect if PNaCl or LLVM format. |
57 AutodetectFileFormat | 58 AutodetectFileFormat |
58 }; | 59 }; |
59 | 60 |
60 // \brief If the given MemoryBuffer holds a bitcode image, return a | 61 // \brief If the given MemoryBuffer holds a bitcode image, return a |
61 // Module for it. Otherwise, attempt to parse it as LLVM Assembly and | 62 // Module for it. Otherwise, attempt to parse it as LLVM Assembly and |
62 // return a Module for it. When Format=PNaClFormat and Verbose | 63 // return a Module for it. |
63 // is non-null, more descriptive error messages are also written to | 64 std::unique_ptr<Module> |
64 // Verbose. | 65 NaClParseIR(MemoryBufferRef Buffer, NaClFileFormat Format, SMDiagnostic &Err, |
65 std::unique_ptr<Module> NaClParseIR(MemoryBufferRef Buffer, | 66 LLVMContext &Context, |
66 NaClFileFormat Format, | 67 DiagnosticHandlerFunction DiagnosticHandler = nullptr); |
67 SMDiagnostic &Err, | |
68 raw_ostream *Verbose, | |
69 LLVMContext &Context); | |
70 | 68 |
71 /// \brief If the given file holds a Bitcode image, read the file. | 69 /// \brief If the given file holds a Bitcode image, read the file. |
72 /// Otherwise, attempt to parse it as LLVM assembly and return a | 70 /// Otherwise, attempt to parse it as LLVM assembly and return a |
73 /// Module for it. When Format=PNaClFormat and Verbose | 71 /// Module for it. |
74 // is non-null, more descriptive error messages are also written to | 72 std::unique_ptr<Module> |
75 // Verbose. | 73 NaClParseIRFile(StringRef Filename, NaClFileFormat Format, SMDiagnostic &Err, |
76 std::unique_ptr<Module> NaClParseIRFile(StringRef Filename, | 74 LLVMContext &Context, |
77 NaClFileFormat Format, | 75 DiagnosticHandlerFunction DiagnosticHandler = nullptr); |
78 SMDiagnostic &Err, | |
79 raw_ostream *Verbose, | |
80 LLVMContext &Context); | |
81 // @LOCALMOD-END | 76 // @LOCALMOD-END |
82 } | 77 } |
83 | 78 |
84 #endif | 79 #endif |
OLD | NEW |