Skip to content

Commit 558478a

Browse files
committed
---
yaml --- r: 31174 b: refs/heads/dist-snap c: 28c1f21 h: refs/heads/master v: v3
1 parent 01a4b14 commit 558478a

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: d7f4d8d12b3f69576d6c63f9da4c20c71174b141
10+
refs/heads/dist-snap: 28c1f21433a927bf9e3b399ec293cd7f7b688af6
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/rustc/back/link.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import libc::{c_int, c_uint};
1+
import libc::{c_int, c_uint, c_char};
22
import driver::session;
33
import session::session;
44
import lib::llvm::llvm;
@@ -32,6 +32,21 @@ fn llvm_err(sess: session, msg: str) -> ! unsafe {
3232
} else { sess.fatal(msg + ": " + str::unsafe::from_c_str(cstr)); }
3333
}
3434

35+
fn WriteOutputFile(sess:session,
36+
PM: lib::llvm::PassManagerRef, M: ModuleRef,
37+
Triple: *c_char,
38+
// FIXME: When #2334 is fixed, change
39+
// c_uint to FileType
40+
Output: *c_char, FileType: c_uint,
41+
OptLevel: c_int,
42+
EnableSegmentedStacks: bool) {
43+
let result = llvm::LLVMRustWriteOutputFile(
44+
PM, M, Triple, Output, FileType, OptLevel, EnableSegmentedStacks);
45+
if (!result) {
46+
llvm_err(sess, "Could not write output");
47+
}
48+
}
49+
3550
mod write {
3651
fn is_object_or_assembly_or_exe(ot: output_type) -> bool {
3752
if ot == output_type_assembly || ot == output_type_object ||
@@ -160,7 +175,8 @@ mod write {
160175
sess.targ_cfg.target_strs.target_triple,
161176
|buf_t| {
162177
str::as_c_str(output, |buf_o| {
163-
llvm::LLVMRustWriteOutputFile(
178+
WriteOutputFile(
179+
sess,
164180
pm.llpm,
165181
llmod,
166182
buf_t,
@@ -181,7 +197,8 @@ mod write {
181197
sess.targ_cfg.target_strs.target_triple,
182198
|buf_t| {
183199
str::as_c_str(output, |buf_o| {
184-
llvm::LLVMRustWriteOutputFile(
200+
WriteOutputFile(
201+
sess,
185202
pm.llpm,
186203
llmod,
187204
buf_t,
@@ -200,7 +217,8 @@ mod write {
200217
sess.targ_cfg.target_strs.target_triple,
201218
|buf_t| {
202219
str::as_c_str(output, |buf_o| {
203-
llvm::LLVMRustWriteOutputFile(
220+
WriteOutputFile(
221+
sess,
204222
pm.llpm,
205223
llmod,
206224
buf_t,

branches/dist-snap/src/rustc/lib/llvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ extern mod llvm {
941941
// c_uint to FileType
942942
Output: *c_char, FileType: c_uint,
943943
OptLevel: c_int,
944-
EnableSegmentedStacks: bool);
944+
EnableSegmentedStacks: bool) -> bool;
945945

946946
/** Returns a string describing the last error caused by an LLVMRust*
947947
call. */

branches/dist-snap/src/rustllvm/RustWrapper.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ extern "C" bool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src) {
7575
return true;
7676
}
7777

78-
extern "C" void
78+
extern "C" bool
7979
LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
8080
LLVMModuleRef M,
8181
const char *triple,
@@ -107,13 +107,18 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
107107
std::string ErrorInfo;
108108
raw_fd_ostream OS(path, ErrorInfo,
109109
raw_fd_ostream::F_Binary);
110+
if (ErrorInfo != "") {
111+
LLVMRustError = ErrorInfo.c_str();
112+
return false;
113+
}
110114
formatted_raw_ostream FOS(OS);
111115

112116
bool foo = Target->addPassesToEmitFile(*PM, FOS, FileType, NoVerify);
113117
assert(!foo);
114118
(void)foo;
115119
PM->run(*unwrap(M));
116120
delete Target;
121+
return true;
117122
}
118123

119124
extern "C" LLVMModuleRef LLVMRustParseAssemblyFile(const char *Filename) {

branches/dist-snap/src/test/run-pass/pipe-select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// xfail-test
1+
// xfail
22
// xfail-pretty
33
// xfail-win32
44

0 commit comments

Comments
 (0)