Skip to content

Commit

Permalink
main: Program will now print the help message if no arguments were pa…
Browse files Browse the repository at this point in the history
…ssed.
  • Loading branch information
stnuessl committed Dec 31, 2016
1 parent 4d59ace commit 3c99472
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,18 @@ int main(int argc, const char **argv)
};

llvm::cl::SetVersionPrinter(print_version);

llvm::cl::ParseCommandLineOptions(argc, argv);

/*
* Seems like 'ParseCommandLineOptions' has to be called before
* running this. Otherwise 'PrintHelpMessage' will cause a
* segmentation fault.
* Also, 'PrintHelpMessage' will terminate the program.
*/
if (argc <= 1)
llvm::cl::PrintHelpMessage(false, true);

#ifdef __unix__
if (!AllowRoot && getuid() == 0) {
std::cerr << cl::Error()
Expand Down

0 comments on commit 3c99472

Please sign in to comment.