Changeset View
Changeset View
Standalone View
Standalone View
src/ClazyStandaloneMain.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 44 | static cl::opt<std::string> s_checks("checks", cl::desc("Comma-separated list of clazy checks. Default is level1"), | |||
---|---|---|---|---|---|
45 | cl::init(""), cl::cat(s_clazyCategory)); | 45 | cl::init(""), cl::cat(s_clazyCategory)); | ||
46 | 46 | | |||
47 | static cl::opt<bool> s_noInplaceFixits("no-inplace-fixits", cl::desc("Fixits will be applied to a separate file (for unit-test use only)"), | 47 | static cl::opt<bool> s_noInplaceFixits("no-inplace-fixits", cl::desc("Fixits will be applied to a separate file (for unit-test use only)"), | ||
48 | cl::init(false), cl::cat(s_clazyCategory)); | 48 | cl::init(false), cl::cat(s_clazyCategory)); | ||
49 | 49 | | |||
50 | static cl::opt<bool> s_enableAllFixits("enable-all-fixits", cl::desc("Enables all fixits"), | 50 | static cl::opt<bool> s_enableAllFixits("enable-all-fixits", cl::desc("Enables all fixits"), | ||
51 | cl::init(false), cl::cat(s_clazyCategory)); | 51 | cl::init(false), cl::cat(s_clazyCategory)); | ||
52 | 52 | | |||
53 | static cl::opt<std::string> s_exportFixes("export-fixes", cl::desc("YAML file to store suggested fixes in. The stored fixes can be applied to the input source code with clang-apply-replacements."), | ||||
54 | cl::init(""), cl::cat(s_clazyCategory)); | ||||
55 | | ||||
53 | static cl::opt<bool> s_qt4Compat("qt4-compat", cl::desc("Turns off checks not compatible with Qt 4"), | 56 | static cl::opt<bool> s_qt4Compat("qt4-compat", cl::desc("Turns off checks not compatible with Qt 4"), | ||
54 | cl::init(false), cl::cat(s_clazyCategory)); | 57 | cl::init(false), cl::cat(s_clazyCategory)); | ||
55 | 58 | | |||
56 | static cl::opt<bool> s_onlyQt("only-qt", cl::desc("Won't emit warnings for non-Qt files, or in other words, if -DQT_CORE_LIB is missing."), | 59 | static cl::opt<bool> s_onlyQt("only-qt", cl::desc("Won't emit warnings for non-Qt files, or in other words, if -DQT_CORE_LIB is missing."), | ||
57 | cl::init(false), cl::cat(s_clazyCategory)); | 60 | cl::init(false), cl::cat(s_clazyCategory)); | ||
58 | 61 | | |||
59 | static cl::opt<bool> s_qtDeveloper("qt-developer", cl::desc("For running clazy on Qt itself, optional, but honours specific guidelines"), | 62 | static cl::opt<bool> s_qtDeveloper("qt-developer", cl::desc("For running clazy on Qt itself, optional, but honours specific guidelines"), | ||
60 | cl::init(false), cl::cat(s_clazyCategory)); | 63 | cl::init(false), cl::cat(s_clazyCategory)); | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 105 | if (s_onlyQt.getValue()) | |||
103 | options |= ClazyContext::ClazyOption_OnlyQt; | 106 | options |= ClazyContext::ClazyOption_OnlyQt; | ||
104 | 107 | | |||
105 | if (s_visitImplicitCode.getValue()) | 108 | if (s_visitImplicitCode.getValue()) | ||
106 | options |= ClazyContext::ClazyOption_VisitImplicitCode; | 109 | options |= ClazyContext::ClazyOption_VisitImplicitCode; | ||
107 | 110 | | |||
108 | if (s_ignoreIncludedFiles.getValue()) | 111 | if (s_ignoreIncludedFiles.getValue()) | ||
109 | options |= ClazyContext::ClazyOption_IgnoreIncludedFiles; | 112 | options |= ClazyContext::ClazyOption_IgnoreIncludedFiles; | ||
110 | 113 | | |||
111 | return new ClazyStandaloneASTAction(s_checks.getValue(), s_headerFilter.getValue(), s_ignoreDirs.getValue(), options); | 114 | // TODO: We need to agregate the fixes with previous run | ||
115 | return new ClazyStandaloneASTAction(s_checks.getValue(), s_headerFilter.getValue(), s_ignoreDirs.getValue(), s_exportFixes.getValue(), options); | ||||
112 | } | 116 | } | ||
113 | }; | 117 | }; | ||
114 | 118 | | |||
115 | int main(int argc, const char **argv) | 119 | int main(int argc, const char **argv) | ||
116 | { | 120 | { | ||
117 | CommonOptionsParser optionsParser(argc, argv, s_clazyCategory); | 121 | CommonOptionsParser optionsParser(argc, argv, s_clazyCategory); | ||
118 | ClangTool tool(optionsParser.getCompilations(), optionsParser.getSourcePathList()); | 122 | ClangTool tool(optionsParser.getCompilations(), optionsParser.getSourcePathList()); | ||
119 | 123 | | |||
120 | return tool.run(new ClazyToolActionFactory()); | 124 | return tool.run(new ClazyToolActionFactory()); | ||
121 | } | 125 | } |