1
Fork 0

rustc: Start implementing compat with LLVM 9

This commit doesn't actually migrate to LLVM 9, but it brings our own
C++ bindings in line with LLVM 9 and able to compile against tip of
tree. The changes made were:

* The `MainSubprogram` flag for debuginfo moved between flag types.
* Iteration of archive members was tweaked slightly and we have to
  construct the two iterators before constructing the returned
  `RustArchiveIterator` value.
* The `getOrInsertFunction` binding now returns a wrapper which we use
  `getCallee()` on to get the value we're interested in.
This commit is contained in:
Alex Crichton 2019-04-04 13:05:41 -07:00
parent 52980d0fb3
commit d5985bc9ec
4 changed files with 44 additions and 26 deletions

View file

@ -296,12 +296,6 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
let mut flags = DIFlags::FlagPrototyped;
if let Some((id, _)) = self.tcx.entry_fn(LOCAL_CRATE) {
if id == def_id {
flags |= DIFlags::FlagMainSubprogram;
}
}
if self.layout_of(sig.output()).abi.is_uninhabited() {
flags |= DIFlags::FlagNoReturn;
}
@ -313,6 +307,11 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
if self.sess().opts.optimize != config::OptLevel::No {
spflags |= DISPFlags::SPFlagOptimized;
}
if let Some((id, _)) = self.tcx.entry_fn(LOCAL_CRATE) {
if id == def_id {
spflags |= DISPFlags::SPFlagMainSubprogram;
}
}
let fn_metadata = unsafe {
llvm::LLVMRustDIBuilderCreateFunction(