Index: tools/pnacl-thaw/pnacl-thaw.cpp |
diff --git a/tools/pnacl-thaw/pnacl-thaw.cpp b/tools/pnacl-thaw/pnacl-thaw.cpp |
index b28c357165779af6ec11dd6e5e19cb225e8b7f31..6d23f69fde71c0f575eaf56e019c645d53367ef8 100644 |
--- a/tools/pnacl-thaw/pnacl-thaw.cpp |
+++ b/tools/pnacl-thaw/pnacl-thaw.cpp |
@@ -33,12 +33,19 @@ OutputFilename("o", cl::desc("Specify thawed pexe filename"), |
cl::value_desc("filename")); |
static cl::opt<std::string> |
-InputFilename(cl::Positional, cl::desc("<frozen file>"), cl::Required); |
+InputFilename(cl::Positional, cl::desc("<frozen file>"), cl::init("-")); |
static void WriteOutputFile(const Module *M) { |
- std::string ThawedFilename = |
- (OutputFilename.size() == 0 ? (InputFilename + ".thawed") : OutputFilename); |
+ std::string ThawedFilename(OutputFilename); |
+ if (OutputFilename.size() == 0) { |
+ std::string input_filename; |
+ if (InputFilename == "-") |
+ input_filename = "<stdin>"; |
+ else |
+ input_filename = InputFilename; |
+ ThawedFilename = input_filename + ".thawed"; |
+ } |
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(getNaClStreamedBitcodeModule(DisplayFilename, streamer, Context, |
&ErrorMessage)); |
if(M.get() != 0 && M->MaterializeAllPermanently(&ErrorMessage)) { |