[llvm-commits] CVS: llvm/tools/llvm-as/llvm-as.cpp
Jeff Cohen
jeffc at jolt-lang.org
Sat Jan 22 09:36:31 PST 2005
Changes in directory llvm/tools/llvm-as:
llvm-as.cpp updated: 1.41 -> 1.42
---
Log message:
Use binary mode for reading/writing bytecode files
---
Diffs of the changes: (+16 -15)
llvm-as.cpp | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
Index: llvm/tools/llvm-as/llvm-as.cpp
diff -u llvm/tools/llvm-as/llvm-as.cpp:1.41 llvm/tools/llvm-as/llvm-as.cpp:1.42
--- llvm/tools/llvm-as/llvm-as.cpp:1.41 Sat Jan 1 18:08:46 2005
+++ llvm/tools/llvm-as/llvm-as.cpp Sat Jan 22 11:36:17 2005
@@ -84,25 +84,26 @@
<< "Use -f command line argument to force output\n";
return 1;
}
- Out = new std::ofstream(OutputFilename.c_str(), std::ios_base::out |
- std::ios_base::trunc | std::ios_base::binary);
+ Out = new std::ofstream(OutputFilename.c_str(), std::ios::out |
+ std::ios::trunc | std::ios::binary);
} else { // Specified stdout
- Out = &std::cout;
+ // FIXME: cout is not binary!
+ Out = &std::cout;
}
} else {
if (InputFilename == "-") {
- OutputFilename = "-";
- Out = &std::cout;
+ OutputFilename = "-";
+ Out = &std::cout;
} else {
- std::string IFN = InputFilename;
- int Len = IFN.length();
- if (IFN[Len-3] == '.' && IFN[Len-2] == 'l' && IFN[Len-1] == 'l') {
- // Source ends in .ll
- OutputFilename = std::string(IFN.begin(), IFN.end()-3);
+ std::string IFN = InputFilename;
+ int Len = IFN.length();
+ if (IFN[Len-3] == '.' && IFN[Len-2] == 'l' && IFN[Len-1] == 'l') {
+ // Source ends in .ll
+ OutputFilename = std::string(IFN.begin(), IFN.end()-3);
} else {
- OutputFilename = IFN; // Append a .bc to it
- }
- OutputFilename += ".bc";
+ OutputFilename = IFN; // Append a .bc to it
+ }
+ OutputFilename += ".bc";
if (!Force && std::ifstream(OutputFilename.c_str())) {
// If force is not specified, make sure not to overwrite a file!
@@ -112,8 +113,8 @@
return 1;
}
- Out = new std::ofstream(OutputFilename.c_str(), std::ios_base::out |
- std::ios_base::trunc | std::ios_base::binary);
+ Out = new std::ofstream(OutputFilename.c_str(), std::ios::out |
+ std::ios::trunc | std::ios::binary);
// Make sure that the Out file gets unlinked from the disk if we get a
// SIGINT
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
More information about the llvm-commits
mailing list