1 //===- diagtool_main.h - Entry point for invoking all diagnostic tools ----===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the main function for diagtool.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "DiagTool.h"
14 
15 using namespace diagtool;
16 
main(int argc,char * argv[])17 int main(int argc, char *argv[]) {
18   if (argc > 1)
19     if (DiagTool *tool = diagTools->getTool(argv[1]))
20       return tool->run(argc - 2, &argv[2], llvm::outs());
21 
22   llvm::errs() << "usage: diagtool <command> [<args>]\n\n";
23   diagTools->printCommands(llvm::errs());
24   return 1;
25 }
26