Index: tools/pnacl-freeze/pnacl-freeze.cpp |
diff --git a/tools/pnacl-freeze/pnacl-freeze.cpp b/tools/pnacl-freeze/pnacl-freeze.cpp |
index 963000a714a5063d224e00bc328348bcd343eba1..694284198c7f8efb20eb54f85a9910cd969c12d6 100644 |
--- a/tools/pnacl-freeze/pnacl-freeze.cpp |
+++ b/tools/pnacl-freeze/pnacl-freeze.cpp |
@@ -34,12 +34,19 @@ OutputFilename("o", cl::desc("Specify output filename"), |
cl::value_desc("filename")); |
static cl::opt<std::string> |
-InputFilename(cl::Positional, cl::desc("<pexe file>"), cl::Required); |
+InputFilename(cl::Positional, cl::desc("<pexe file>"), cl::init("-")); |
static void WriteOutputFile(const Module *M) { |
- std::string FrozenFilename = |
- (OutputFilename.size() == 0 ? (InputFilename + ".frozen") : OutputFilename); |
+ std::string FrozenFilename(OutputFilename); |
+ if (OutputFilename.size() == 0) { |
+ std::string input_filename; |
+ if (InputFilename == "-") |
+ input_filename = "<stdin>"; |
jvoung (off chromium)
2013/05/02 22:12:50
What some of the other tools do is set OutputFilen
Karl
2013/05/06 16:21:51
I guess this is ok. I just have to redirect my min
|
+ else |
+ input_filename = InputFilename; |
+ FrozenFilename = input_filename + ".frozen"; |
+ } |
std::string ErrorInfo; |
OwningPtr<tool_output_file> Out |
@@ -72,7 +79,11 @@ int main(int argc, char **argv) { |
// Use the bitcode streaming interface |
DataStreamer *streamer = getDataFileStreamer(InputFilename, &ErrorMessage); |
if (streamer) { |
- std::string DisplayFilename = InputFilename; |
+ std::string DisplayFilename; |
+ if (InputFilename == "-") |
+ DisplayFilename = "<stdin>"; |
+ else |
+ DisplayFilename = InputFilename; |
M.reset(getStreamedBitcodeModule(DisplayFilename, streamer, Context, |
&ErrorMessage)); |
if(M.get() != 0 && M->MaterializeAllPermanently(&ErrorMessage)) { |