Last active
April 20, 2019 03:09
-
-
Save chichunchen/32838bcf7a53b69c5ff8a03a06b54ae4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace { | |
| llvm::cl::OptionCategory UseOverrideCategory("Use override options"); | |
| llvm::cl::extrahelp UseOverrideCategoryHelp(R"( | |
| This tool ensures that you use the 'override' keyword appropriately. | |
| For example, given this snippet of code: | |
| struct Base { | |
| virtual void method(int); | |
| }; | |
| struct Derived : public Base { | |
| void method(int); | |
| }; | |
| Running this tool over the code will produce a warning message stating that the | |
| declaration 'method()' should be followed by the keyword 'override'. | |
| )"); | |
| } | |
| auto main(int argc, const char* argv[]) -> int { | |
| using namespace clang::tooling; | |
| CommonOptionsParser OptionsParser(argc, argv, UseOverrideCategory); | |
| ClangTool Tool(OptionsParser.getCompilations(), | |
| OptionsParser.getSourcePathList()); | |
| auto action = newFrontendActionFactory<UseOverride::Action>(); | |
| return Tool.run(action.get()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment