| 33 | } |
| 34 | |
| 35 | int main(int argc, const char **argv) { |
| 36 | llvm::cl::ResetCommandLineParser(); |
| 37 | llvm::cl::opt<bool> OptHelp( |
| 38 | "help", llvm::cl::desc("Display available options"), |
| 39 | llvm::cl::ValueDisallowed, llvm::cl::callback([](const bool &) { |
| 40 | llvm::cl::PrintHelpMessage(); |
| 41 | exit(0); |
| 42 | })); |
| 43 | llvm::cl::opt<bool> OptVersion( |
| 44 | "version", llvm::cl::desc("Display version"), llvm::cl::ValueDisallowed, |
| 45 | llvm::cl::callback([](const bool &) { |
| 46 | llvm::outs() << "version: " << FTG_VERSION << "\n"; |
| 47 | exit(0); |
| 48 | })); |
| 49 | llvm::cl::opt<std::string> BuildDBPath( |
| 50 | "db", llvm::cl::desc("<Required> Path of build db json file"), |
| 51 | llvm::cl::value_desc("filepath"), llvm::cl::Required); |
| 52 | llvm::cl::opt<std::string> LibraryAPIPath( |
| 53 | "public", llvm::cl::desc("<Required> PublicAPI.json path"), |
| 54 | llvm::cl::value_desc("filepath"), llvm::cl::Required); |
| 55 | llvm::cl::opt<std::string> TargetReportDir( |
| 56 | "target", llvm::cl::desc("Target Analyzer report directory path"), |
| 57 | llvm::cl::value_desc("dir_path")); |
| 58 | llvm::cl::opt<std::string> ExternReportDir( |
| 59 | "extern", llvm::cl::desc("External library report directory path"), |
| 60 | llvm::cl::value_desc("dir_path")); |
| 61 | llvm::cl::opt<std::string> UTType("ut", llvm::cl::desc("<Required> UT type"), |
| 62 | llvm::cl::value_desc("string"), |
| 63 | llvm::cl::Required); |
| 64 | llvm::cl::opt<std::string> OutputPath( |
| 65 | "out", llvm::cl::desc("<Required> Output file path"), |
| 66 | llvm::cl::value_desc("filepath"), llvm::cl::Required); |
| 67 | llvm::cl::ParseCommandLineOptions(argc, argv, "UT Analyzer\n"); |
| 68 | |
| 69 | increaseStackSize(); |
| 70 | try { |
| 71 | UTAnalyzer Analyzer(std::make_shared<BuildDBLoader>(BuildDBPath), |
| 72 | std::make_shared<APIJsonLoader>(LibraryAPIPath), |
| 73 | TargetReportDir, ExternReportDir, UTType); |
| 74 | |
| 75 | if (!Analyzer.analyze()) |
| 76 | return 1; |
| 77 | |
| 78 | if (!Analyzer.dump(OutputPath)) |
| 79 | return 1; |
| 80 | } catch (...) { |
| 81 | return 1; |
| 82 | } |
| 83 | |
| 84 | return 0; |
| 85 | } |
nothing calls this directly
no test coverage detected