Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 523232
Collapse All | Expand All

(-)libclc-0.0.1_pre20140101.orig/utils/prepare-builtins.cpp (-7 / +40 lines)
Lines 1-4 Link Here
1
#include "llvm/ADT/OwningPtr.h"
2
#include "llvm/Bitcode/ReaderWriter.h"
1
#include "llvm/Bitcode/ReaderWriter.h"
3
#include "llvm/IR/Function.h"
2
#include "llvm/IR/Function.h"
4
#include "llvm/IR/GlobalVariable.h"
3
#include "llvm/IR/GlobalVariable.h"
Lines 7-17 Link Here
7
#include "llvm/Support/CommandLine.h"
6
#include "llvm/Support/CommandLine.h"
8
#include "llvm/Support/ManagedStatic.h"
7
#include "llvm/Support/ManagedStatic.h"
9
#include "llvm/Support/MemoryBuffer.h"
8
#include "llvm/Support/MemoryBuffer.h"
9
#include "llvm/Support/FileSystem.h"
10
#include "llvm/Support/raw_ostream.h"
10
#include "llvm/Support/raw_ostream.h"
11
#include "llvm/Support/system_error.h"
11
#include "llvm/Support/ErrorOr.h"
12
#include "llvm/Support/ToolOutputFile.h"
12
#include "llvm/Support/ToolOutputFile.h"
13
#include "llvm/Config/config.h"
13
#include "llvm/Config/config.h"
14
14
15
#define LLVM_350_AND_NEWER \
16
  (LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5))
17
18
#if LLVM_350_AND_NEWER
19
#include <system_error>
20
21
#define ERROR_CODE std::error_code
22
#define UNIQUE_PTR std::unique_ptr
23
#else
24
#include "llvm/ADT/OwningPtr.h"
25
#include "llvm/Support/system_error.h"
26
27
#define ERROR_CODE error_code
28
#define UNIQUE_PTR OwningPtr
29
#endif
30
15
using namespace llvm;
31
using namespace llvm;
16
32
17
static cl::opt<std::string>
33
static cl::opt<std::string>
Lines 31-41 int main(int argc, char **argv) { Link Here
31
  std::auto_ptr<Module> M;
47
  std::auto_ptr<Module> M;
32
48
33
  {
49
  {
34
    OwningPtr<MemoryBuffer> BufferPtr;
50
#if LLVM_350_AND_NEWER
35
    if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
51
    ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
52
      MemoryBuffer::getFile(InputFilename);
53
    std::unique_ptr<MemoryBuffer> &BufferPtr = BufferOrErr.get();
54
    if (std::error_code  ec = BufferOrErr.getError())
55
#else
56
    UNIQUE_PTR<MemoryBuffer> BufferPtr;
57
    if (ERROR_CODE ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
58
#endif
36
      ErrorMessage = ec.message();
59
      ErrorMessage = ec.message();
37
    else
60
    else {
61
#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
62
      ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);
63
      if (ERROR_CODE ec = ModuleOrErr.getError())
64
	ErrorMessage = ec.message();
65
      M.reset(ModuleOrErr.get());
66
#else
38
      M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
67
      M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
68
#endif
69
    }
39
  }
70
  }
40
71
41
  if (M.get() == 0) {
72
  if (M.get() == 0) {
Lines 65-74 int main(int argc, char **argv) { Link Here
65
  }
95
  }
66
96
67
  std::string ErrorInfo;
97
  std::string ErrorInfo;
68
  OwningPtr<tool_output_file> Out
98
  UNIQUE_PTR<tool_output_file> Out
69
  (new tool_output_file(OutputFilename.c_str(), ErrorInfo,
99
  (new tool_output_file(OutputFilename.c_str(), ErrorInfo,
70
#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 3)
100
#if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 4)
71
                        sys::fs::F_Binary));
101
                        sys::fs::F_Binary));
102
#elif LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5)
103
                        sys::fs::F_None));
72
#else
104
#else
73
                        raw_fd_ostream::F_Binary));
105
                        raw_fd_ostream::F_Binary));
74
#endif
106
#endif

Return to bug 523232