@@ -48,10 +48,10 @@ namespace ir2vec {
48
48
49
49
static cl::OptionCategory IR2VecToolCategory (" IR2Vec Tool Options" );
50
50
51
- static cl::opt<std::string> InputFilename (cl::Positional,
52
- cl::desc ( " <input bitcode file> " ) ,
53
- cl::Required ,
54
- cl::cat(IR2VecToolCategory));
51
+ static cl::opt<std::string>
52
+ InputFilename ( cl::Positional ,
53
+ cl::desc ( " <input bitcode file or '-' for stdin> " ) ,
54
+ cl::init( " - " ), cl::cat(IR2VecToolCategory));
55
55
56
56
static cl::opt<std::string> OutputFilename (" o" , cl::desc(" Output filename" ),
57
57
cl::value_desc(" filename" ),
@@ -287,10 +287,14 @@ int main(int argc, char **argv) {
287
287
if (Mode == TripletMode && Level.getNumOccurrences () > 0 )
288
288
errs () << " Warning: --level option is ignored in triplet mode\n " ;
289
289
290
- // Parse the input LLVM IR file
290
+ // Parse the input LLVM IR file or stdin
291
291
SMDiagnostic Err;
292
292
LLVMContext Context;
293
- std::unique_ptr<Module> M = parseIRFile (InputFilename, Err, Context);
293
+ std::unique_ptr<Module> M;
294
+
295
+ // Read from file or stdin
296
+ M = parseIRFile (InputFilename, Err, Context);
297
+
294
298
if (!M) {
295
299
Err.print (argv[0 ], errs ());
296
300
return 1 ;
0 commit comments