diff --git a/llvm/tools/llvmc2/llvmc.cpp b/llvm/tools/llvmc2/llvmc.cpp index bb818c317066..b991202e43cf 100644 --- a/llvm/tools/llvmc2/llvmc.cpp +++ b/llvm/tools/llvmc2/llvmc.cpp @@ -32,7 +32,7 @@ using namespace llvmcc; // External linkage here is intentional. cl::list InputFilenames(cl::Positional, cl::desc(""), - cl::OneOrMore); + cl::ZeroOrMore); cl::opt OutputFilename("o", cl::desc("Output file name"), cl::value_desc("file")); cl::opt VerboseMode("v", @@ -70,10 +70,20 @@ int main(int argc, char** argv) { "LLVM Compiler Driver(Work In Progress)"); PopulateCompilationGraph(graph); - if(WriteGraph) + if (WriteGraph) { graph.writeGraph(); - if(ViewGraph) + return 0; + } + + if (ViewGraph) { graph.viewGraph(); + return 0; + } + + if (InputFilenames.empty()) { + std::cerr << "No input files.\n"; + return 1; + } return BuildTargets(graph); }