Skip to content

Commit e3d1488

Browse files
committed
---
yaml --- r: 63432 b: refs/heads/snap-stage3 c: 868f9a8 h: refs/heads/master v: v3
1 parent 3fde4cd commit e3d1488

File tree

10 files changed

+858
-800
lines changed

10 files changed

+858
-800
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 17eec6289be4a5b9f940c7381f087fb0ea2efd22
4+
refs/heads/snap-stage3: 868f9a88d6a0a495c10baa35a2fb359b5681375f
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/lib/llvm.rs

Lines changed: 183 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,51 @@ pub type SectionIteratorRef = *SectionIterator_opaque;
224224
pub enum Pass_opaque {}
225225
pub type PassRef = *Pass_opaque;
226226

227+
pub mod debuginfo {
228+
use core::prelude::*;
229+
use super::{ValueRef};
230+
231+
pub enum DIBuilder_opaque {}
232+
pub type DIBuilderRef = *DIBuilder_opaque;
233+
234+
pub type DIDescriptor = ValueRef;
235+
pub type DIScope = DIDescriptor;
236+
pub type DILocation = DIDescriptor;
237+
pub type DIFile = DIScope;
238+
pub type DILexicalBlock = DIScope;
239+
pub type DISubprogram = DIScope;
240+
pub type DIType = DIDescriptor;
241+
pub type DIBasicType = DIType;
242+
pub type DIDerivedType = DIType;
243+
pub type DICompositeType = DIDerivedType;
244+
pub type DIVariable = DIDescriptor;
245+
pub type DIArray = DIDescriptor;
246+
pub type DISubrange = DIDescriptor;
247+
248+
pub enum DIDescriptorFlags {
249+
FlagPrivate = 1 << 0,
250+
FlagProtected = 1 << 1,
251+
FlagFwdDecl = 1 << 2,
252+
FlagAppleBlock = 1 << 3,
253+
FlagBlockByrefStruct = 1 << 4,
254+
FlagVirtual = 1 << 5,
255+
FlagArtificial = 1 << 6,
256+
FlagExplicit = 1 << 7,
257+
FlagPrototyped = 1 << 8,
258+
FlagObjcClassComplete = 1 << 9,
259+
FlagObjectPointer = 1 << 10,
260+
FlagVector = 1 << 11,
261+
FlagStaticMember = 1 << 12
262+
}
263+
}
264+
227265
pub mod llvm {
228266
use super::{AtomicBinOp, AtomicOrdering, BasicBlockRef, ExecutionEngineRef};
229267
use super::{Bool, BuilderRef, ContextRef, MemoryBufferRef, ModuleRef};
230268
use super::{ObjectFileRef, Opcode, PassManagerRef, PassManagerBuilderRef};
231269
use super::{SectionIteratorRef, TargetDataRef, TypeKind, TypeRef, UseRef};
232-
use super::{ValueRef,PassRef};
233-
270+
use super::{ValueRef, PassRef};
271+
use super::debuginfo::*;
234272
use core::libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong};
235273

236274
#[link_args = "-Lrustllvm -lrustllvm"]
@@ -1885,6 +1923,149 @@ pub mod llvm {
18851923
AlignStack: Bool, Dialect: c_uint)
18861924
-> ValueRef;
18871925

1926+
1927+
#[fast_ffi]
1928+
pub unsafe fn DIBuilder_new(M: ModuleRef) -> DIBuilderRef;
1929+
1930+
#[fast_ffi]
1931+
pub unsafe fn DIBuilder_delete(Builder: DIBuilderRef);
1932+
1933+
#[fast_ffi]
1934+
pub unsafe fn DIBuilder_finalize(Builder: DIBuilderRef);
1935+
1936+
#[fast_ffi]
1937+
pub unsafe fn DIBuilder_createCompileUnit(
1938+
Builder: DIBuilderRef,
1939+
Lang: c_uint,
1940+
File: *c_char,
1941+
Dir: *c_char,
1942+
Producer: *c_char,
1943+
isOptimized: bool,
1944+
Flags: *c_char,
1945+
RuntimeVer: c_uint,
1946+
SplitName: *c_char);
1947+
1948+
#[fast_ffi]
1949+
pub unsafe fn DIBuilder_createFile(
1950+
Builder: DIBuilderRef,
1951+
Filename: *c_char,
1952+
Directory: *c_char) -> DIFile;
1953+
1954+
#[fast_ffi]
1955+
pub unsafe fn DIBuilder_createSubroutineType(
1956+
Builder: DIBuilderRef,
1957+
File: DIFile,
1958+
ParameterTypes: DIArray) -> DICompositeType;
1959+
1960+
#[fast_ffi]
1961+
pub unsafe fn DIBuilder_createFunction(
1962+
Builder: DIBuilderRef,
1963+
Scope: DIDescriptor,
1964+
Name: *c_char,
1965+
LinkageName: *c_char,
1966+
File: DIFile,
1967+
LineNo: c_uint,
1968+
Ty: DIType,
1969+
isLocalToUnit: bool,
1970+
isDefinition: bool,
1971+
ScopeLine: c_uint,
1972+
Flags: c_uint,
1973+
isOptimized: bool,
1974+
Fn: ValueRef,
1975+
TParam: ValueRef,
1976+
Decl: ValueRef) -> DISubprogram;
1977+
1978+
#[fast_ffi]
1979+
pub unsafe fn DIBuilder_createBasicType(
1980+
Builder: DIBuilderRef,
1981+
Name: *c_char,
1982+
SizeInBits: c_ulonglong,
1983+
AlignInBits: c_ulonglong,
1984+
Encoding: c_uint) -> DIBasicType;
1985+
1986+
#[fast_ffi]
1987+
pub unsafe fn DIBuilder_createPointerType(
1988+
Builder: DIBuilderRef,
1989+
PointeeTy: DIType,
1990+
SizeInBits: c_ulonglong,
1991+
AlignInBits: c_ulonglong,
1992+
Name: *c_char) -> DIDerivedType;
1993+
1994+
#[fast_ffi]
1995+
pub unsafe fn DIBuilder_createStructType(
1996+
Builder: DIBuilderRef,
1997+
Scope: DIDescriptor,
1998+
Name: *c_char,
1999+
File: DIFile,
2000+
LineNumber: c_uint,
2001+
SizeInBits: c_ulonglong,
2002+
AlignInBits: c_ulonglong,
2003+
Flags: c_uint,
2004+
DerivedFrom: DIType,
2005+
Elements: DIArray,
2006+
RunTimeLang: c_uint,
2007+
VTableHolder: ValueRef) -> DICompositeType;
2008+
2009+
#[fast_ffi]
2010+
pub unsafe fn DIBuilder_createMemberType(
2011+
Builder: DIBuilderRef,
2012+
Scope: DIDescriptor,
2013+
Name: *c_char,
2014+
File: DIFile,
2015+
LineNo: c_uint,
2016+
SizeInBits: c_ulonglong,
2017+
AlignInBits: c_ulonglong,
2018+
OffsetInBits: c_ulonglong,
2019+
Flags: c_uint,
2020+
Ty: DIType) -> DIDerivedType;
2021+
2022+
#[fast_ffi]
2023+
pub unsafe fn DIBuilder_createLexicalBlock(
2024+
Builder: DIBuilderRef,
2025+
Scope: DIDescriptor,
2026+
File: DIFile,
2027+
Line: c_uint,
2028+
Col: c_uint) -> DILexicalBlock;
2029+
2030+
#[fast_ffi]
2031+
pub unsafe fn DIBuilder_createLocalVariable(
2032+
Builder: DIBuilderRef,
2033+
Tag: c_uint,
2034+
Scope: DIDescriptor,
2035+
Name: *c_char,
2036+
File: DIFile,
2037+
LineNo: c_uint,
2038+
Ty: DIType,
2039+
AlwaysPreserve: bool,
2040+
Flags: c_uint,
2041+
ArgNo: c_uint) -> DIVariable;
2042+
2043+
#[fast_ffi]
2044+
pub unsafe fn DIBuilder_createVectorType(
2045+
Builder: DIBuilderRef,
2046+
Size: c_ulonglong,
2047+
AlignInBits: c_ulonglong,
2048+
Ty: DIType,
2049+
Subscripts: DIArray) -> DIType;
2050+
2051+
#[fast_ffi]
2052+
pub unsafe fn DIBuilder_getOrCreateSubrange(
2053+
Builder: DIBuilderRef,
2054+
Lo: c_longlong,
2055+
Count: c_longlong) -> DISubrange;
2056+
2057+
#[fast_ffi]
2058+
pub unsafe fn DIBuilder_getOrCreateArray(
2059+
Builder: DIBuilderRef,
2060+
Ptr: *DIDescriptor,
2061+
Count: c_uint) -> DIArray;
2062+
2063+
#[fast_ffi]
2064+
pub unsafe fn DIBuilder_insertDeclare(
2065+
Builder: DIBuilderRef,
2066+
Val: ValueRef,
2067+
VarInfo: DIVariable,
2068+
InsertBefore: *c_void) -> *c_void;
18882069
}
18892070
}
18902071

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3074,6 +3074,7 @@ pub fn trans_crate(sess: session::Session,
30743074
// 1. http://llvm.org/bugs/show_bug.cgi?id=11479
30753075
let llmod_id = link_meta.name.to_owned() + ".rc";
30763076
3077+
Some(debuginfo::mk_ctxt(llmod, copy llmod_id))
30773078
// FIXME(#6511): get LLVM building with --enable-threads so this
30783079
// function can be called
30793080
// if !llvm::LLVMRustStartMultithreading() {
@@ -3102,7 +3103,10 @@ pub fn trans_crate(sess: session::Session,
31023103
fill_crate_map(ccx, ccx.crate_map);
31033104
glue::emit_tydescs(ccx);
31043105
write_abi_version(ccx);
3105-
3106+
if ccx.sess.opts.debuginfo {
3107+
debuginfo::finalize(ccx);
3108+
}
3109+
31063110
// Translate the metadata.
31073111
write_metadata(ccx, crate);
31083112
if ccx.sess.trans_stats() {

0 commit comments

Comments
 (0)