Refactor TargetOptions::data_layout into an Optional value to reflect current usage.
NFC.
This commit is contained in:
parent
6f142404d6
commit
cdf6cebc00
2 changed files with 13 additions and 6 deletions
|
|
@ -229,9 +229,8 @@ unsafe fn create_context_and_module(sess: &Session, mod_name: &str) -> (ContextR
|
|||
let mod_name = CString::new(mod_name).unwrap();
|
||||
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
|
||||
|
||||
let custom_data_layout = &sess.target.target.options.data_layout[..];
|
||||
if custom_data_layout.len() > 0 {
|
||||
let data_layout = CString::new(custom_data_layout).unwrap();
|
||||
if let Some(ref custom_data_layout) = sess.target.target.options.data_layout {
|
||||
let data_layout = CString::new(&custom_data_layout[..]).unwrap();
|
||||
llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr());
|
||||
} else {
|
||||
let tm = ::back::write::create_target_machine(sess);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue