Skip to content

Commit

Permalink
rustc: de-@ llvm.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Apr 22, 2014
1 parent 637addd commit 70f3409
Showing 1 changed file with 12 additions and 39 deletions.
51 changes: 12 additions & 39 deletions src/librustc/lib/llvm.rs
Expand Up @@ -1882,37 +1882,23 @@ impl TypeNames {

/* Memory-managed interface to target data. */

pub struct target_data_res {
pub td: TargetDataRef,
pub struct TargetData {
pub lltd: TargetDataRef
}

impl Drop for target_data_res {
impl Drop for TargetData {
fn drop(&mut self) {
unsafe {
llvm::LLVMDisposeTargetData(self.td);
llvm::LLVMDisposeTargetData(self.lltd);
}
}
}

pub fn target_data_res(td: TargetDataRef) -> target_data_res {
target_data_res {
td: td
}
}

pub struct TargetData {
pub lltd: TargetDataRef,
dtor: @target_data_res
}

pub fn mk_target_data(string_rep: &str) -> TargetData {
let lltd = string_rep.with_c_str(|buf| {
unsafe { llvm::LLVMCreateTargetData(buf) }
});

TargetData {
lltd: lltd,
dtor: @target_data_res(lltd)
lltd: string_rep.with_c_str(|buf| {
unsafe { llvm::LLVMCreateTargetData(buf) }
})
}
}

Expand Down Expand Up @@ -1949,35 +1935,22 @@ impl Drop for ObjectFile {

/* Memory-managed interface to section iterators. */

pub struct section_iter_res {
pub si: SectionIteratorRef,
pub struct SectionIter {
pub llsi: SectionIteratorRef
}

impl Drop for section_iter_res {
impl Drop for SectionIter {
fn drop(&mut self) {
unsafe {
llvm::LLVMDisposeSectionIterator(self.si);
llvm::LLVMDisposeSectionIterator(self.llsi);
}
}
}

pub fn section_iter_res(si: SectionIteratorRef) -> section_iter_res {
section_iter_res {
si: si
}
}

pub struct SectionIter {
pub llsi: SectionIteratorRef,
dtor: @section_iter_res
}

pub fn mk_section_iter(llof: ObjectFileRef) -> SectionIter {
unsafe {
let llsi = llvm::LLVMGetSections(llof);
SectionIter {
llsi: llsi,
dtor: @section_iter_res(llsi)
llsi: llvm::LLVMGetSections(llof)
}
}
}

5 comments on commit 70f3409

@bors
Copy link
Contributor

@bors bors commented on 70f3409 Apr 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at eddyb@70f3409

@bors
Copy link
Contributor

@bors bors commented on 70f3409 Apr 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging eddyb/rust/more-de-at = 70f3409 into auto

@bors
Copy link
Contributor

@bors bors commented on 70f3409 Apr 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eddyb/rust/more-de-at = 70f3409 merged ok, testing candidate = 16a5b31

@bors
Copy link
Contributor

@bors bors commented on 70f3409 Apr 22, 2014

@bors
Copy link
Contributor

@bors bors commented on 70f3409 Apr 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 16a5b31

Please sign in to comment.