Skip to content

Commit 077be49

Browse files
committed
rustc_llvm: move to rustc_codegen_llvm::llvm.
1 parent 54628c8 commit 077be49

File tree

11 files changed

+348
-358
lines changed

11 files changed

+348
-358
lines changed

src/Cargo.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,11 +2222,8 @@ dependencies = [
22222222
name = "rustc_llvm"
22232223
version = "0.0.0"
22242224
dependencies = [
2225-
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
22262225
"build_helper 0.1.0",
22272226
"cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
2228-
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
2229-
"rustc_cratesio_shim 0.0.0",
22302227
]
22312228

22322229
[[package]]

src/librustc_codegen_llvm/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#![feature(rustc_diagnostic_macros)]
3030
#![feature(slice_sort_by_cached_key)]
3131
#![feature(optin_builtin_traits)]
32+
#![feature(concat_idents)]
33+
#![feature(link_args)]
34+
#![feature(static_nobundle)]
3235

3336
use rustc::dep_graph::WorkProduct;
3437
use syntax_pos::symbol::Symbol;
@@ -46,7 +49,7 @@ extern crate rustc_target;
4649
#[macro_use] extern crate rustc_data_structures;
4750
extern crate rustc_demangle;
4851
extern crate rustc_incremental;
49-
extern crate rustc_llvm as llvm;
52+
extern crate rustc_llvm;
5053
extern crate rustc_platform_intrinsics as intrinsics;
5154
extern crate rustc_codegen_utils;
5255

@@ -110,6 +113,7 @@ mod debuginfo;
110113
mod declare;
111114
mod glue;
112115
mod intrinsic;
116+
pub mod llvm;
113117
mod llvm_util;
114118
mod metadata;
115119
mod meth;

src/librustc_llvm/archive_ro.rs renamed to src/librustc_codegen_llvm/llvm/archive_ro.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! A wrapper around LLVM's archive (.a) code
1212
13-
use ArchiveRef;
13+
use super::ArchiveRef;
1414

1515
use std::ffi::CString;
1616
use std::marker;
@@ -26,11 +26,11 @@ unsafe impl Send for ArchiveRO {}
2626

2727
pub struct Iter<'a> {
2828
archive: &'a ArchiveRO,
29-
ptr: ::ArchiveIteratorRef,
29+
ptr: super::ArchiveIteratorRef,
3030
}
3131

3232
pub struct Child<'a> {
33-
ptr: ::ArchiveChildRef,
33+
ptr: super::ArchiveChildRef,
3434
_data: marker::PhantomData<&'a ArchiveRO>,
3535
}
3636

@@ -44,9 +44,9 @@ impl ArchiveRO {
4444
pub fn open(dst: &Path) -> Result<ArchiveRO, String> {
4545
return unsafe {
4646
let s = path2cstr(dst);
47-
let ar = ::LLVMRustOpenArchive(s.as_ptr());
47+
let ar = super::LLVMRustOpenArchive(s.as_ptr());
4848
if ar.is_null() {
49-
Err(::last_error().unwrap_or("failed to open archive".to_string()))
49+
Err(super::last_error().unwrap_or("failed to open archive".to_string()))
5050
} else {
5151
Ok(ArchiveRO { ptr: ar })
5252
}
@@ -72,7 +72,7 @@ impl ArchiveRO {
7272
pub fn iter(&self) -> Iter {
7373
unsafe {
7474
Iter {
75-
ptr: ::LLVMRustArchiveIteratorNew(self.ptr),
75+
ptr: super::LLVMRustArchiveIteratorNew(self.ptr),
7676
archive: self,
7777
}
7878
}
@@ -82,7 +82,7 @@ impl ArchiveRO {
8282
impl Drop for ArchiveRO {
8383
fn drop(&mut self) {
8484
unsafe {
85-
::LLVMRustDestroyArchive(self.ptr);
85+
super::LLVMRustDestroyArchive(self.ptr);
8686
}
8787
}
8888
}
@@ -91,9 +91,9 @@ impl<'a> Iterator for Iter<'a> {
9191
type Item = Result<Child<'a>, String>;
9292

9393
fn next(&mut self) -> Option<Result<Child<'a>, String>> {
94-
let ptr = unsafe { ::LLVMRustArchiveIteratorNext(self.ptr) };
94+
let ptr = unsafe { super::LLVMRustArchiveIteratorNext(self.ptr) };
9595
if ptr.is_null() {
96-
::last_error().map(Err)
96+
super::last_error().map(Err)
9797
} else {
9898
Some(Ok(Child {
9999
ptr,
@@ -106,7 +106,7 @@ impl<'a> Iterator for Iter<'a> {
106106
impl<'a> Drop for Iter<'a> {
107107
fn drop(&mut self) {
108108
unsafe {
109-
::LLVMRustArchiveIteratorFree(self.ptr);
109+
super::LLVMRustArchiveIteratorFree(self.ptr);
110110
}
111111
}
112112
}
@@ -115,7 +115,7 @@ impl<'a> Child<'a> {
115115
pub fn name(&self) -> Option<&'a str> {
116116
unsafe {
117117
let mut name_len = 0;
118-
let name_ptr = ::LLVMRustArchiveChildName(self.ptr, &mut name_len);
118+
let name_ptr = super::LLVMRustArchiveChildName(self.ptr, &mut name_len);
119119
if name_ptr.is_null() {
120120
None
121121
} else {
@@ -128,23 +128,23 @@ impl<'a> Child<'a> {
128128
pub fn data(&self) -> &'a [u8] {
129129
unsafe {
130130
let mut data_len = 0;
131-
let data_ptr = ::LLVMRustArchiveChildData(self.ptr, &mut data_len);
131+
let data_ptr = super::LLVMRustArchiveChildData(self.ptr, &mut data_len);
132132
if data_ptr.is_null() {
133133
panic!("failed to read data from archive child");
134134
}
135135
slice::from_raw_parts(data_ptr as *const u8, data_len as usize)
136136
}
137137
}
138138

139-
pub fn raw(&self) -> ::ArchiveChildRef {
139+
pub fn raw(&self) -> super::ArchiveChildRef {
140140
self.ptr
141141
}
142142
}
143143

144144
impl<'a> Drop for Child<'a> {
145145
fn drop(&mut self) {
146146
unsafe {
147-
::LLVMRustArchiveChildFree(self.ptr);
147+
super::LLVMRustArchiveChildFree(self.ptr);
148148
}
149149
}
150150
}

src/librustc_llvm/diagnostic.rs renamed to src/librustc_codegen_llvm/llvm/diagnostic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub use self::Diagnostic::*;
1616
use libc::c_uint;
1717
use std::ptr;
1818

19-
use {DiagnosticInfoRef, TwineRef, ValueRef};
19+
use super::{DiagnosticInfoRef, TwineRef, ValueRef};
2020

2121
#[derive(Copy, Clone)]
2222
pub enum OptimizationDiagnosticKind {
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@
1414
// This method was changed in this LLVM patch:
1515
// https://reviews.llvm.org/D26769
1616

17-
use debuginfo::{DIBuilderRef, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
18-
DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
19-
DIGlobalVariable, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
20-
DINameSpace, DIFlags};
17+
use super::debuginfo::{
18+
DIBuilderRef, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
19+
DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
20+
DIGlobalVariable, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
21+
DINameSpace, DIFlags,
22+
};
2123

2224
use libc::{c_uint, c_int, size_t, c_char};
2325
use libc::{c_longlong, c_ulonglong, c_void};
2426

25-
use RustStringRef;
27+
use super::RustStringRef;
2628

2729
pub type Opcode = u32;
2830
pub type Bool = c_uint;
@@ -512,13 +514,6 @@ pub mod debuginfo {
512514

513515
pub enum ModuleBuffer {}
514516

515-
// This annotation is primarily needed for MSVC where attributes like
516-
// dllimport/dllexport are applied and need to be correct for everything to
517-
// link successfully. The #[link] annotation here says "these symbols are
518-
// included statically" which means that they're all exported with dllexport
519-
// and from the rustc_llvm dynamic library. Otherwise the rustc_codegen_llvm dynamic
520-
// library would not be able to access these symbols.
521-
#[link(name = "rustllvm", kind = "static")]
522517
extern "C" {
523518
// Create and destroy contexts.
524519
pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> ContextRef;

0 commit comments

Comments
 (0)