diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2022-06-14 15:16:51 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2022-06-19 12:56:31 +0000 |
| commit | 18c6fe5798c70d532742cfda6c21d61daee257a4 (patch) | |
| tree | 624ba9d59f92c8e97370c4fb8ee527df42f48359 /compiler/rustc_codegen_llvm/src | |
| parent | 7ff0df51024a96e91f41c3760b5676ebbdc7a2c0 (diff) | |
| download | rust-18c6fe5798c70d532742cfda6c21d61daee257a4.tar.gz rust-18c6fe5798c70d532742cfda6c21d61daee257a4.zip | |
Remove the source archive functionality of ArchiveWriter
We now build archives through strictly additive means rather than taking an existing archive and potentially substracting parts.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/archive.rs | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs index 1f4bfffaafe..58ad8af7472 100644 --- a/compiler/rustc_codegen_llvm/src/back/archive.rs +++ b/compiler/rustc_codegen_llvm/src/back/archive.rs @@ -20,9 +20,7 @@ use rustc_session::Session; pub struct LlvmArchiveBuilder<'a> { sess: &'a Session, dst: PathBuf, - src: Option<PathBuf>, additions: Vec<Addition>, - src_archive: Option<Option<ArchiveRO>>, } enum Addition { @@ -59,14 +57,8 @@ fn llvm_machine_type(cpu: &str) -> LLVMMachineType { impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> { /// Creates a new static archive, ready for modifying the archive specified /// by `config`. - fn new(sess: &'a Session, output: &Path, input: Option<&Path>) -> LlvmArchiveBuilder<'a> { - LlvmArchiveBuilder { - sess, - dst: output.to_path_buf(), - src: input.map(|p| p.to_path_buf()), - additions: Vec::new(), - src_archive: None, - } + fn new(sess: &'a Session, output: &Path) -> LlvmArchiveBuilder<'a> { + LlvmArchiveBuilder { sess, dst: output.to_path_buf(), additions: Vec::new() } } fn add_archive<F>(&mut self, archive: &Path, skip: F) -> io::Result<()> @@ -257,15 +249,6 @@ impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> { } impl<'a> LlvmArchiveBuilder<'a> { - fn src_archive(&mut self) -> Option<&ArchiveRO> { - if let Some(ref a) = self.src_archive { - return a.as_ref(); - } - let src = self.src.as_ref()?; - self.src_archive = Some(ArchiveRO::open(src).ok()); - self.src_archive.as_ref().unwrap().as_ref() - } - fn llvm_archive_kind(&self) -> Result<ArchiveKind, &str> { let kind = &*self.sess.target.archive_format; kind.parse().map_err(|_| kind) @@ -279,20 +262,6 @@ impl<'a> LlvmArchiveBuilder<'a> { let dst = CString::new(self.dst.to_str().unwrap())?; unsafe { - if let Some(archive) = self.src_archive() { - for child in archive.iter() { - let child = child.map_err(string_to_io_error)?; - let Some(child_name) = child.name() else { continue }; - - let name = CString::new(child_name)?; - members.push(llvm::LLVMRustArchiveMemberNew( - ptr::null(), - name.as_ptr(), - Some(child.raw), - )); - strings.push(name); - } - } for addition in &mut additions { match addition { Addition::File { path, name_in_archive } => { |
