about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2019-01-16 09:59:03 -0800
committerJosh Stone <jistone@redhat.com>2019-01-25 15:39:54 -0800
commitdf0466d0bb807a7266cc8ac9931cd43b3e84b62e (patch)
tree5e0ec889065b1aea33f6bf9630d8f70003816f46 /src/librustc_codegen_llvm
parentbf669d1e3295bc688f71b8c91f48a6beaf895f67 (diff)
downloadrust-df0466d0bb807a7266cc8ac9931cd43b3e84b62e.tar.gz
rust-df0466d0bb807a7266cc8ac9931cd43b3e84b62e.zip
Rebase to the llvm-project monorepo
The new git submodule src/llvm-project is a monorepo replacing src/llvm
and src/tools/{clang,lld,lldb}.  This also serves as a rebase for these
projects to the new 8.x branch from trunk.

The src/llvm-emscripten fork is unchanged for now.
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/debuginfo/mod.rs15
-rw-r--r--src/librustc_codegen_llvm/llvm/ffi.rs22
2 files changed, 27 insertions, 10 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs
index b504aa515fd..113b9958c7f 100644
--- a/src/librustc_codegen_llvm/debuginfo/mod.rs
+++ b/src/librustc_codegen_llvm/debuginfo/mod.rs
@@ -12,7 +12,7 @@ use self::source_loc::InternalDebugLocation::{self, UnknownLocation};
 
 use llvm;
 use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilder, DISubprogram, DIArray, DIFlags,
-    DILexicalBlock};
+    DISPFlags, DILexicalBlock};
 use rustc::hir::CodegenFnAttrFlags;
 use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE};
 use rustc::ty::subst::{Substs, UnpackedKind};
@@ -283,7 +283,6 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
         let linkage_name = mangled_name_of_instance(self, instance);
 
         let scope_line = span_start(self, span).line;
-        let is_local_to_unit = is_node_local_to_unit(self, def_id);
 
         let function_name = CString::new(name).unwrap();
         let linkage_name = SmallCStr::new(&linkage_name.as_str());
@@ -300,6 +299,14 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
             flags |= DIFlags::FlagNoReturn;
         }
 
+        let mut spflags = DISPFlags::SPFlagDefinition;
+        if is_node_local_to_unit(self, def_id) {
+            spflags |= DISPFlags::SPFlagLocalToUnit;
+        }
+        if self.sess().opts.optimize != config::OptLevel::No {
+            spflags |= DISPFlags::SPFlagOptimized;
+        }
+
         let fn_metadata = unsafe {
             llvm::LLVMRustDIBuilderCreateFunction(
                 DIB(self),
@@ -309,11 +316,9 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
                 file_metadata,
                 loc.line as c_uint,
                 function_type_metadata,
-                is_local_to_unit,
-                true,
                 scope_line as c_uint,
                 flags,
-                self.sess().opts.optimize != config::OptLevel::No,
+                spflags,
                 llfn,
                 template_parameters,
                 None)
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index 11e34f600c2..853c1ff0047 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -2,7 +2,7 @@ use super::debuginfo::{
     DIBuilder, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
     DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
     DIGlobalVariableExpression, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
-    DINameSpace, DIFlags,
+    DINameSpace, DIFlags, DISPFlags,
 };
 
 use libc::{c_uint, c_int, size_t, c_char};
@@ -591,6 +591,20 @@ pub mod debuginfo {
             const FlagMainSubprogram      = (1 << 21);
         }
     }
+
+    // These values **must** match with LLVMRustDISPFlags!!
+    bitflags! {
+        #[repr(C)]
+        #[derive(Default)]
+        pub struct DISPFlags: ::libc::uint32_t {
+            const SPFlagZero              = 0;
+            const SPFlagVirtual           = 1;
+            const SPFlagPureVirtual       = 2;
+            const SPFlagLocalToUnit       = (1 << 2);
+            const SPFlagDefinition        = (1 << 3);
+            const SPFlagOptimized         = (1 << 4);
+        }
+    }
 }
 
 extern { pub type ModuleBuffer; }
@@ -1387,11 +1401,9 @@ extern "C" {
                                            File: &'a DIFile,
                                            LineNo: c_uint,
                                            Ty: &'a DIType,
-                                           isLocalToUnit: bool,
-                                           isDefinition: bool,
                                            ScopeLine: c_uint,
                                            Flags: DIFlags,
-                                           isOptimized: bool,
+                                           SPFlags: DISPFlags,
                                            Fn: &'a Value,
                                            TParam: &'a DIArray,
                                            Decl: Option<&'a DIDescriptor>)
@@ -1529,7 +1541,7 @@ extern "C" {
                                                   AlignInBits: u32,
                                                   Elements: &'a DIArray,
                                                   ClassType: &'a DIType,
-                                                  IsFixed: bool)
+                                                  IsScoped: bool)
                                                   -> &'a DIType;
 
     pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,