summaryrefslogtreecommitdiff
path: root/tools/llvm-as
diff options
context:
space:
mode:
authorJeff Cohen <jeffc@jolt-lang.org>2005-01-22 17:36:17 +0000
committerJeff Cohen <jeffc@jolt-lang.org>2005-01-22 17:36:17 +0000
commit5fb6ed4ae608c6f7ef589f1069b5dd5c7bdbd60b (patch)
tree1a699df0388afa1ed3d3acc4e4cd91085adbed10 /tools/llvm-as
parent695c9bdbd0ad9d540dea68e201cd616afb4320d4 (diff)
downloadllvm-5fb6ed4ae608c6f7ef589f1069b5dd5c7bdbd60b.tar.gz
llvm-5fb6ed4ae608c6f7ef589f1069b5dd5c7bdbd60b.tar.bz2
llvm-5fb6ed4ae608c6f7ef589f1069b5dd5c7bdbd60b.tar.xz
Use binary mode for reading/writing bytecode files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-as')
-rw-r--r--tools/llvm-as/llvm-as.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp
index ef1602b6a7..a28e804ffc 100644
--- a/tools/llvm-as/llvm-as.cpp
+++ b/tools/llvm-as/llvm-as.cpp
@@ -84,25 +84,26 @@ int main(int argc, char **argv) {
<< "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 @@ int main(int argc, char **argv) {
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));