Skip to content

Commit d253e66

Browse files
author
Jeroen Ketema
committed
Fix breakage after r211259
While we are here introduce the proper headers for the error code. Reviewed-by: Tom Stellard <tom@stellard.net> llvm-svn: 211432
1 parent fa30168 commit d253e66

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

libclc/utils/prepare-builtins.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "llvm/ADT/OwningPtr.h"
21
#include "llvm/Bitcode/ReaderWriter.h"
32
#include "llvm/IR/Function.h"
43
#include "llvm/IR/GlobalVariable.h"
@@ -13,17 +12,24 @@
1312
#include "llvm/Support/ToolOutputFile.h"
1413
#include "llvm/Config/config.h"
1514

16-
using namespace llvm;
17-
1815
#define LLVM_350_AND_NEWER \
1916
(LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5))
2017

2118
#if LLVM_350_AND_NEWER
19+
#include <system_error>
20+
2221
#define ERROR_CODE std::error_code
22+
#define UNIQUE_PTR std::unique_ptr
2323
#else
24+
#include "llvm/ADT/OwningPtr.h"
25+
#include "llvm/Support/system_error.h"
26+
2427
#define ERROR_CODE error_code
28+
#define UNIQUE_PTR OwningPtr
2529
#endif
2630

31+
using namespace llvm;
32+
2733
static cl::opt<std::string>
2834
InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
2935

@@ -41,11 +47,7 @@ int main(int argc, char **argv) {
4147
std::auto_ptr<Module> M;
4248

4349
{
44-
#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
45-
std::unique_ptr<MemoryBuffer> BufferPtr;
46-
#else
47-
OwningPtr<MemoryBuffer> BufferPtr;
48-
#endif
50+
UNIQUE_PTR<MemoryBuffer> BufferPtr;
4951
if (ERROR_CODE ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
5052
ErrorMessage = ec.message();
5153
else {
@@ -87,7 +89,7 @@ int main(int argc, char **argv) {
8789
}
8890

8991
std::string ErrorInfo;
90-
OwningPtr<tool_output_file> Out
92+
UNIQUE_PTR<tool_output_file> Out
9193
(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
9294
#if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 4)
9395
sys::fs::F_Binary));

0 commit comments

Comments
 (0)