Skip to content

Commit 0ab1034

Browse files
committed
prepare-builtins: Use std:: prefix for error_code
This fixes the build with with newer LLVM. llvm-svn: 210867
1 parent bff5d0d commit 0ab1034

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

libclc/utils/prepare-builtins.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515

1616
using namespace llvm;
1717

18+
#define LLVM_350_AND_NEWER \
19+
(LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5))
20+
21+
#if LLVM_350_AND_NEWER
22+
#define ERROR_CODE std::error_code
23+
#else
24+
#define ERROR_CODE error_code
25+
#endif
26+
1827
static cl::opt<std::string>
1928
InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
2029

@@ -37,12 +46,12 @@ int main(int argc, char **argv) {
3746
#else
3847
OwningPtr<MemoryBuffer> BufferPtr;
3948
#endif
40-
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
49+
if (ERROR_CODE ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
4150
ErrorMessage = ec.message();
4251
else {
4352
#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
4453
ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);
45-
if (error_code ec = ModuleOrErr.getError())
54+
if (ERROR_CODE ec = ModuleOrErr.getError())
4655
ErrorMessage = ec.message();
4756
M.reset(ModuleOrErr.get());
4857
#else

0 commit comments

Comments
 (0)