[LLVM 4.0] Fix CreateCompileUnit
This commit is contained in:
parent
064a0ee131
commit
68fff62542
@ -1334,8 +1334,7 @@ extern "C" {
|
||||
|
||||
pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
|
||||
Lang: c_uint,
|
||||
File: *const c_char,
|
||||
Dir: *const c_char,
|
||||
File: DIFile,
|
||||
Producer: *const c_char,
|
||||
isOptimized: bool,
|
||||
Flags: *const c_char,
|
||||
|
@ -787,17 +787,20 @@ pub fn compile_unit_metadata(scc: &SharedCrateContext,
|
||||
(option_env!("CFG_VERSION")).expect("CFG_VERSION"));
|
||||
|
||||
let compile_unit_name = compile_unit_name.as_ptr();
|
||||
let work_dir = path2cstr(&work_dir);
|
||||
let producer = CString::new(producer).unwrap();
|
||||
let work_dir = path2cstr(&work_dir).as_ptr();
|
||||
let producer = CString::new(producer).unwrap().as_ptr();
|
||||
let flags = "\0";
|
||||
let split_name = "\0";
|
||||
return unsafe {
|
||||
llvm::LLVMRustDIBuilderCreateCompileUnit(
|
||||
|
||||
unsafe {
|
||||
let file_metadata = llvm::LLVMRustDIBuilderCreateFile(
|
||||
debug_context.builder, compile_unit_name, work_dir);
|
||||
|
||||
return llvm::LLVMRustDIBuilderCreateCompileUnit(
|
||||
debug_context.builder,
|
||||
DW_LANG_RUST,
|
||||
compile_unit_name,
|
||||
work_dir.as_ptr(),
|
||||
producer.as_ptr(),
|
||||
file_metadata,
|
||||
producer,
|
||||
sess.opts.optimize != config::OptLevel::No,
|
||||
flags.as_ptr() as *const _,
|
||||
0,
|
||||
|
@ -474,11 +474,19 @@ extern "C" void LLVMRustDIBuilderFinalize(LLVMRustDIBuilderRef Builder) {
|
||||
}
|
||||
|
||||
extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateCompileUnit(
|
||||
LLVMRustDIBuilderRef Builder, unsigned Lang, const char *File,
|
||||
const char *Dir, const char *Producer, bool isOptimized, const char *Flags,
|
||||
LLVMRustDIBuilderRef Builder, unsigned Lang, LLVMRustMetadataRef FileRef,
|
||||
const char *Producer, bool isOptimized, const char *Flags,
|
||||
unsigned RuntimeVer, const char *SplitName) {
|
||||
return wrap(Builder->createCompileUnit(Lang, File, Dir, Producer, isOptimized,
|
||||
auto *File = unwrapDI<DIFile>(FileRef);
|
||||
|
||||
#if LLVM_VERSION_GE(4, 0)
|
||||
return wrap(Builder->createCompileUnit(Lang, File, Producer, isOptimized,
|
||||
Flags, RuntimeVer, SplitName));
|
||||
#else
|
||||
return wrap(Builder->createCompileUnit(Lang, File->getFilename(),
|
||||
File->getDirectory(), Producer, isOptimized,
|
||||
Flags, RuntimeVer, SplitName));
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" LLVMRustMetadataRef
|
||||
|
Loading…
Reference in New Issue
Block a user