Skip to content

Commit e8e0569

Browse files
committed
1 parent 7b64d98 commit e8e0569

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

tools/pnacl-freeze/pnacl-freeze.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,16 @@ using namespace llvm;
3131

3232
static cl::opt<std::string>
3333
OutputFilename("o", cl::desc("Specify output filename"),
34-
cl::value_desc("filename"));
34+
cl::value_desc("filename"), cl::init("-"));
3535

3636
static cl::opt<std::string>
37-
InputFilename(cl::Positional, cl::desc("<pexe file>"), cl::Required);
37+
InputFilename(cl::Positional, cl::desc("<pexe file>"), cl::init("-"));
3838

3939
static void WriteOutputFile(const Module *M) {
4040

41-
std::string FrozenFilename =
42-
(OutputFilename.size() == 0 ? (InputFilename + ".frozen") : OutputFilename);
43-
4441
std::string ErrorInfo;
4542
OwningPtr<tool_output_file> Out
46-
(new tool_output_file(FrozenFilename.c_str(), ErrorInfo,
43+
(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
4744
raw_fd_ostream::F_Binary));
4845
if (!ErrorInfo.empty()) {
4946
errs() << ErrorInfo << '\n';
@@ -72,7 +69,11 @@ int main(int argc, char **argv) {
7269
// Use the bitcode streaming interface
7370
DataStreamer *streamer = getDataFileStreamer(InputFilename, &ErrorMessage);
7471
if (streamer) {
75-
std::string DisplayFilename = InputFilename;
72+
std::string DisplayFilename;
73+
if (InputFilename == "-")
74+
DisplayFilename = "<stdin>";
75+
else
76+
DisplayFilename = InputFilename;
7677
M.reset(getStreamedBitcodeModule(DisplayFilename, streamer, Context,
7778
&ErrorMessage));
7879
if(M.get() != 0 && M->MaterializeAllPermanently(&ErrorMessage)) {

tools/pnacl-thaw/pnacl-thaw.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,16 @@ using namespace llvm;
3030

3131
static cl::opt<std::string>
3232
OutputFilename("o", cl::desc("Specify thawed pexe filename"),
33-
cl::value_desc("filename"));
33+
cl::value_desc("filename"), cl::init("-"));
3434

3535
static cl::opt<std::string>
36-
InputFilename(cl::Positional, cl::desc("<frozen file>"), cl::Required);
36+
InputFilename(cl::Positional, cl::desc("<frozen file>"), cl::init("-"));
3737

3838
static void WriteOutputFile(const Module *M) {
3939

40-
std::string ThawedFilename =
41-
(OutputFilename.size() == 0 ? (InputFilename + ".thawed") : OutputFilename);
42-
4340
std::string ErrorInfo;
4441
OwningPtr<tool_output_file> Out
45-
(new tool_output_file(ThawedFilename.c_str(), ErrorInfo,
42+
(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
4643
raw_fd_ostream::F_Binary));
4744
if (!ErrorInfo.empty()) {
4845
errs() << ErrorInfo << '\n';
@@ -72,7 +69,11 @@ int main(int argc, char **argv) {
7269
// Use the bitcode streaming interface
7370
DataStreamer *streamer = getDataFileStreamer(InputFilename, &ErrorMessage);
7471
if (streamer) {
75-
std::string DisplayFilename = InputFilename;
72+
std::string DisplayFilename;
73+
if (InputFilename == "-")
74+
DisplayFilename = "<stdin>";
75+
else
76+
DisplayFilename = InputFilename;
7677
M.reset(getNaClStreamedBitcodeModule(DisplayFilename, streamer, Context,
7778
&ErrorMessage));
7879
if(M.get() != 0 && M->MaterializeAllPermanently(&ErrorMessage)) {

0 commit comments

Comments
 (0)