summaryrefslogtreecommitdiff
path: root/tools/llvm-as
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2005-01-02 00:08:46 +0000
committerReid Spencer <rspencer@reidspencer.com>2005-01-02 00:08:46 +0000
commitb687c0c21860ab080768a89b06b3afa4eb660311 (patch)
treeb6ec2c004b6d6fc6c9c2e181cd48e347b2994794 /tools/llvm-as
parent5737913c46ca7dc1b1f7ebfcf2c1c99e2e235696 (diff)
downloadllvm-b687c0c21860ab080768a89b06b3afa4eb660311.tar.gz
llvm-b687c0c21860ab080768a89b06b3afa4eb660311.tar.bz2
llvm-b687c0c21860ab080768a89b06b3afa4eb660311.tar.xz
Prevent output of bytecode to std::cout unless the --force flag is given.
This prevents bytecode splats with usage like: cat file.ll | llvm-as - git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19239 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-as')
-rw-r--r--tools/llvm-as/llvm-as.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp
index eb77a33165..ef1602b6a7 100644
--- a/tools/llvm-as/llvm-as.cpp
+++ b/tools/llvm-as/llvm-as.cpp
@@ -20,6 +20,7 @@
#include "llvm/Bytecode/Writer.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/SystemUtils.h"
#include "llvm/System/Signals.h"
#include <fstream>
#include <iostream>
@@ -124,7 +125,9 @@ int main(int argc, char **argv) {
return 1;
}
- WriteBytecodeToFile(M.get(), *Out, !NoCompress);
+ if (Force || !CheckBytecodeOutputToConsole(Out,true)) {
+ WriteBytecodeToFile(M.get(), *Out, !NoCompress);
+ }
} catch (const ParseException &E) {
std::cerr << argv[0] << ": " << E.getMessage() << "\n";
exitCode = 1;