Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/llvm/ext/llvm_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ using namespace llvm;
#define LLVM_VERSION_LE(major, minor) \
(LLVM_VERSION_MAJOR < (major) || LLVM_VERSION_MAJOR == (major) && LLVM_VERSION_MINOR <= (minor))

#if LLVM_VERSION_GE(6, 0)
#include <llvm-c/DebugInfo.h>
#endif

#if LLVM_VERSION_GE(4, 0)
#include <llvm/Bitcode/BitcodeWriter.h>
#include <llvm/Analysis/ModuleSummaryAnalysis.h>
Expand Down Expand Up @@ -56,14 +60,16 @@ LLVMDIBuilderRef LLVMNewDIBuilder(LLVMModuleRef mref) {
return wrap(new DIBuilder(*m));
}

#if LLVM_VERSION_LE(5, 9)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: there won't be any 5.x other than 5.0. LE(5, 0) is enough, no need to indroduce unknown version numbers :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I just fixed this locally, but @RX14 merged in parallel before I pushed it.

I'll send a tiny new PR to fix it and reference it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RX14 @ysbaddaden I fixed this in #6383.

void LLVMDIBuilderFinalize(LLVMDIBuilderRef dref) { unwrap(dref)->finalize(); }
#endif

LLVMMetadataRef LLVMDIBuilderCreateFile(DIBuilderRef Dref, const char *File,
LLVMMetadataRef LLVMDIBuilderCreateFile2(DIBuilderRef Dref, const char *File,
const char *Dir) {
return wrap(Dref->createFile(File, Dir));
}

LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(DIBuilderRef Dref, unsigned Lang,
LLVMMetadataRef LLVMDIBuilderCreateCompileUnit2(DIBuilderRef Dref, unsigned Lang,
const char *File,
const char *Dir,
const char *Producer,
Expand Down
1 change: 1 addition & 0 deletions src/llvm/lib_llvm.cr
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ end

{% begin %}
lib LibLLVM
IS_60 = {{LibLLVM::VERSION.starts_with?("6.0")}}
IS_50 = {{LibLLVM::VERSION.starts_with?("5.0")}}
IS_40 = {{LibLLVM::VERSION.starts_with?("4.0")}}
IS_39 = {{LibLLVM::VERSION.starts_with?("3.9")}}
Expand Down
14 changes: 7 additions & 7 deletions src/llvm/lib_llvm_ext.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ lib LibLLVMExt
scope_line : UInt, flags : LLVM::DIFlags, is_optimized : Bool, func : LibLLVM::ValueRef
) : Metadata

fun di_builder_create_file = LLVMDIBuilderCreateFile(builder : DIBuilder, file : Char*, dir : Char*) : Metadata
fun di_builder_create_compile_unit = LLVMDIBuilderCreateCompileUnit(builder : DIBuilder,
lang : UInt, file : Char*,
dir : Char*,
producer : Char*,
optimized : Int, flags : Char*,
runtime_version : UInt) : Metadata
fun di_builder_create_file = LLVMDIBuilderCreateFile2(builder : DIBuilder, file : Char*, dir : Char*) : Metadata
fun di_builder_create_compile_unit = LLVMDIBuilderCreateCompileUnit2(builder : DIBuilder,
lang : UInt, file : Char*,
dir : Char*,
producer : Char*,
optimized : Int, flags : Char*,
runtime_version : UInt) : Metadata
fun di_builder_create_lexical_block = LLVMDIBuilderCreateLexicalBlock(builder : DIBuilder,
scope : Metadata,
file : Metadata,
Expand Down