Skip to content

Commit 04213eb

Browse files
committed
rollup merge of #21818: dotdash/llvm_up
2 parents c64b73e + 602e508 commit 04213eb

File tree

9 files changed

+283
-205
lines changed

9 files changed

+283
-205
lines changed

src/librustc_llvm/lib.rs

Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ use libc::{c_uint, c_ushort, uint64_t, c_int, size_t, c_char};
6363
use libc::{c_longlong, c_ulonglong, c_void};
6464
use debuginfo::{DIBuilderRef, DIDescriptor,
6565
DIFile, DILexicalBlock, DISubprogram, DIType,
66-
DIBasicType, DIDerivedType, DICompositeType,
67-
DIVariable, DIGlobalVariable, DIArray, DISubrange};
66+
DIBasicType, DIDerivedType, DICompositeType, DIScope,
67+
DIVariable, DIGlobalVariable, DIArray, DISubrange,
68+
DITemplateTypeParameter, DIEnumerator, DINameSpace};
6869

6970
pub mod archive_ro;
7071
pub mod diagnostic;
@@ -442,6 +443,9 @@ pub type TypeRef = *mut Type_opaque;
442443
pub enum Value_opaque {}
443444
pub type ValueRef = *mut Value_opaque;
444445
#[allow(missing_copy_implementations)]
446+
pub enum Metadata_opaque {}
447+
pub type MetadataRef = *mut Metadata_opaque;
448+
#[allow(missing_copy_implementations)]
445449
pub enum BasicBlock_opaque {}
446450
pub type BasicBlockRef = *mut BasicBlock_opaque;
447451
#[allow(missing_copy_implementations)]
@@ -501,18 +505,19 @@ pub type InlineAsmDiagHandler = unsafe extern "C" fn(SMDiagnosticRef, *const c_v
501505

502506
pub mod debuginfo {
503507
pub use self::DIDescriptorFlags::*;
504-
use super::{ValueRef};
508+
use super::{MetadataRef};
505509

506510
#[allow(missing_copy_implementations)]
507511
pub enum DIBuilder_opaque {}
508512
pub type DIBuilderRef = *mut DIBuilder_opaque;
509513

510-
pub type DIDescriptor = ValueRef;
514+
pub type DIDescriptor = MetadataRef;
511515
pub type DIScope = DIDescriptor;
512516
pub type DILocation = DIDescriptor;
513517
pub type DIFile = DIScope;
514518
pub type DILexicalBlock = DIScope;
515519
pub type DISubprogram = DIScope;
520+
pub type DINameSpace = DIScope;
516521
pub type DIType = DIDescriptor;
517522
pub type DIBasicType = DIType;
518523
pub type DIDerivedType = DIType;
@@ -521,6 +526,8 @@ pub mod debuginfo {
521526
pub type DIGlobalVariable = DIDescriptor;
522527
pub type DIArray = DIDescriptor;
523528
pub type DISubrange = DIDescriptor;
529+
pub type DIEnumerator = DIDescriptor;
530+
pub type DITemplateTypeParameter = DIDescriptor;
524531

525532
#[derive(Copy)]
526533
pub enum DIDescriptorFlags {
@@ -1778,8 +1785,8 @@ extern {
17781785
Flags: c_uint,
17791786
isOptimized: bool,
17801787
Fn: ValueRef,
1781-
TParam: ValueRef,
1782-
Decl: ValueRef)
1788+
TParam: DIArray,
1789+
Decl: DIDescriptor)
17831790
-> DISubprogram;
17841791

17851792
pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef,
@@ -1807,7 +1814,7 @@ extern {
18071814
DerivedFrom: DIType,
18081815
Elements: DIArray,
18091816
RunTimeLang: c_uint,
1810-
VTableHolder: ValueRef,
1817+
VTableHolder: DIType,
18111818
UniqueId: *const c_char)
18121819
-> DICompositeType;
18131820

@@ -1824,25 +1831,25 @@ extern {
18241831
-> DIDerivedType;
18251832

18261833
pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
1827-
Scope: DIDescriptor,
1834+
Scope: DIScope,
18281835
File: DIFile,
18291836
Line: c_uint,
18301837
Col: c_uint)
18311838
-> DILexicalBlock;
18321839

18331840
pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
1834-
Context: DIDescriptor,
1841+
Context: DIScope,
18351842
Name: *const c_char,
18361843
LinkageName: *const c_char,
18371844
File: DIFile,
18381845
LineNo: c_uint,
18391846
Ty: DIType,
18401847
isLocalToUnit: bool,
18411848
Val: ValueRef,
1842-
Decl: ValueRef)
1849+
Decl: DIDescriptor)
18431850
-> DIGlobalVariable;
18441851

1845-
pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
1852+
pub fn LLVMDIBuilderCreateVariable(Builder: DIBuilderRef,
18461853
Tag: c_uint,
18471854
Scope: DIDescriptor,
18481855
Name: *const c_char,
@@ -1851,6 +1858,8 @@ extern {
18511858
Ty: DIType,
18521859
AlwaysPreserve: bool,
18531860
Flags: c_uint,
1861+
AddrOps: *const i64,
1862+
AddrOpsCount: c_uint,
18541863
ArgNo: c_uint)
18551864
-> DIVariable;
18561865

@@ -1881,79 +1890,80 @@ extern {
18811890
pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
18821891
Val: ValueRef,
18831892
VarInfo: DIVariable,
1893+
AddrOps: *const i64,
1894+
AddrOpsCount: c_uint,
18841895
InsertAtEnd: BasicBlockRef)
18851896
-> ValueRef;
18861897

18871898
pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef,
18881899
Val: ValueRef,
18891900
VarInfo: DIVariable,
1901+
AddrOps: *const i64,
1902+
AddrOpsCount: c_uint,
18901903
InsertBefore: ValueRef)
18911904
-> ValueRef;
18921905

18931906
pub fn LLVMDIBuilderCreateEnumerator(Builder: DIBuilderRef,
18941907
Name: *const c_char,
18951908
Val: c_ulonglong)
1896-
-> ValueRef;
1909+
-> DIEnumerator;
18971910

18981911
pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
1899-
Scope: ValueRef,
1912+
Scope: DIScope,
19001913
Name: *const c_char,
1901-
File: ValueRef,
1914+
File: DIFile,
19021915
LineNumber: c_uint,
19031916
SizeInBits: c_ulonglong,
19041917
AlignInBits: c_ulonglong,
1905-
Elements: ValueRef,
1906-
ClassType: ValueRef)
1907-
-> ValueRef;
1918+
Elements: DIArray,
1919+
ClassType: DIType)
1920+
-> DIType;
19081921

19091922
pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef,
1910-
Scope: ValueRef,
1923+
Scope: DIScope,
19111924
Name: *const c_char,
1912-
File: ValueRef,
1925+
File: DIFile,
19131926
LineNumber: c_uint,
19141927
SizeInBits: c_ulonglong,
19151928
AlignInBits: c_ulonglong,
19161929
Flags: c_uint,
1917-
Elements: ValueRef,
1930+
Elements: DIArray,
19181931
RunTimeLang: c_uint,
19191932
UniqueId: *const c_char)
1920-
-> ValueRef;
1933+
-> DIType;
19211934

19221935
pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
19231936

19241937
pub fn LLVMDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
1925-
Scope: ValueRef,
1938+
Scope: DIScope,
19261939
Name: *const c_char,
1927-
Ty: ValueRef,
1928-
File: ValueRef,
1940+
Ty: DIType,
1941+
File: DIFile,
19291942
LineNo: c_uint,
19301943
ColumnNo: c_uint)
1931-
-> ValueRef;
1932-
1933-
pub fn LLVMDIBuilderCreateOpDeref(IntType: TypeRef) -> ValueRef;
1944+
-> DITemplateTypeParameter;
19341945

1935-
pub fn LLVMDIBuilderCreateOpPlus(IntType: TypeRef) -> ValueRef;
1946+
pub fn LLVMDIBuilderCreateOpDeref() -> i64;
19361947

1937-
pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
1938-
Tag: c_uint,
1939-
Scope: ValueRef,
1940-
Name: *const c_char,
1941-
File: ValueRef,
1942-
LineNo: c_uint,
1943-
Ty: ValueRef,
1944-
AddrOps: *const ValueRef,
1945-
AddrOpsCount: c_uint,
1946-
ArgNo: c_uint)
1947-
-> ValueRef;
1948+
pub fn LLVMDIBuilderCreateOpPlus() -> i64;
19481949

19491950
pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
1950-
Scope: ValueRef,
1951+
Scope: DIScope,
19511952
Name: *const c_char,
1952-
File: ValueRef,
1953+
File: DIFile,
19531954
LineNo: c_uint)
1954-
-> ValueRef;
1955+
-> DINameSpace;
1956+
1957+
pub fn LLVMDIBuilderCreateDebugLocation(Context: ContextRef,
1958+
Line: c_uint,
1959+
Column: c_uint,
1960+
Scope: DIScope,
1961+
InlinedAt: MetadataRef)
1962+
-> ValueRef;
19551963

1956-
pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
1964+
pub fn LLVMDICompositeTypeSetTypeArray(Builder: DIBuilderRef,
1965+
CompositeType: DIType,
1966+
TypeArray: DIArray);
19571967
pub fn LLVMWriteTypeToString(Type: TypeRef, s: RustStringRef);
19581968
pub fn LLVMWriteValueToString(value_ref: ValueRef, s: RustStringRef);
19591969

src/librustc_trans/trans/base.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,11 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
20192019
let bcx = match dest {
20202020
expr::SaveIn(_) => bcx,
20212021
expr::Ignore => {
2022-
glue::drop_ty(bcx, llresult, result_ty, debug_loc)
2022+
let bcx = glue::drop_ty(bcx, llresult, result_ty, debug_loc);
2023+
if !type_is_zero_size(ccx, result_ty) {
2024+
call_lifetime_end(bcx, llresult);
2025+
}
2026+
bcx
20232027
}
20242028
};
20252029

src/librustc_trans/trans/common.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -778,10 +778,6 @@ pub fn C_i32(ccx: &CrateContext, i: i32) -> ValueRef {
778778
C_integral(Type::i32(ccx), i as u64, true)
779779
}
780780

781-
pub fn C_i64(ccx: &CrateContext, i: i64) -> ValueRef {
782-
C_integral(Type::i64(ccx), i as u64, true)
783-
}
784-
785781
pub fn C_u64(ccx: &CrateContext, i: u64) -> ValueRef {
786782
C_integral(Type::i64(ccx), i, false)
787783
}

src/librustc_trans/trans/datum.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ impl KindOps for Rvalue {
199199
-> Block<'blk, 'tcx> {
200200
// No cleanup is scheduled for an rvalue, so we don't have
201201
// to do anything after a move to cancel or duplicate it.
202+
if self.is_by_ref() {
203+
call_lifetime_end(bcx, _val);
204+
}
202205
bcx
203206
}
204207

@@ -320,6 +323,7 @@ impl<'tcx> Datum<'tcx, Rvalue> {
320323
ByValue => DatumBlock::new(bcx, self),
321324
ByRef => {
322325
let llval = load_ty(bcx, self.val, self.ty);
326+
call_lifetime_end(bcx, self.val);
323327
DatumBlock::new(bcx, Datum::new(llval, self.ty, Rvalue::new(ByValue)))
324328
}
325329
}

0 commit comments

Comments
 (0)