summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-as/llvm-as.cpp
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
commit742af2f2eb1be40ef673d179f9df0005c8104d8b (patch)
tree799acbd116459e6eeea5fa68967a443439428099 /llvm/tools/llvm-as/llvm-as.cpp
parentc967184a502db039b610366ffdfd2ccb4553665a (diff)
downloadbcm5719-llvm-742af2f2eb1be40ef673d179f9df0005c8104d8b.tar.gz
bcm5719-llvm-742af2f2eb1be40ef673d179f9df0005c8104d8b.zip
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 - llvm-svn: 19239
Diffstat (limited to 'llvm/tools/llvm-as/llvm-as.cpp')
-rw-r--r--llvm/tools/llvm-as/llvm-as.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp
index eb77a33165b..ef1602b6a72 100644
--- a/llvm/tools/llvm-as/llvm-as.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud