Style and Doc fix for CommonOptionsParser
- Renaming GetCompilations() and GetSourcePathList() to follow LLVM
style.
- Updating docs to reflect name change.
- Also updating help text to not mention clang-check since this class
can be used by any tool.
Reviewed By: Alexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170229 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/docs/LibASTMatchersTutorial.rst b/docs/LibASTMatchersTutorial.rst
index 21d2689..3d0af67 100644
--- a/docs/LibASTMatchersTutorial.rst
+++ b/docs/LibASTMatchersTutorial.rst
@@ -145,8 +145,8 @@
int main(int argc, const char **argv) {
CommonOptionsParser OptionsParser(argc, argv);
- ClangTool Tool(OptionsParser.GetCompilations(),
- OptionsParser.GetSourcePathList());
+ ClangTool Tool(OptionsParser.getCompilations(),
+ OptionsParser.getSourcePathList());
return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>());
}
@@ -279,8 +279,8 @@
int main(int argc, const char **argv) {
CommonOptionsParser OptionsParser(argc, argv);
- ClangTool Tool(OptionsParser.GetCompilations(),
- OptionsParser.GetSourcePathList());
+ ClangTool Tool(OptionsParser.getCompilations(),
+ OptionsParser.getSourcePathList());
LoopPrinter Printer;
MatchFinder Finder;
diff --git a/docs/LibTooling.rst b/docs/LibTooling.rst
index d9c17f6..8c2a126 100644
--- a/docs/LibTooling.rst
+++ b/docs/LibTooling.rst
@@ -68,7 +68,7 @@
// CompilationDatabase. In case of error it will terminate the program.
CommonOptionsParser OptionsParser(argc, argv);
- // Use OptionsParser.GetCompilations() and OptionsParser.GetSourcePathList()
+ // Use OptionsParser.getCompilations() and OptionsParser.getSourcePathList()
// to retrieve CompilationDatabase and the list of input file paths.
}
@@ -88,7 +88,7 @@
// We hand the CompilationDatabase we created and the sources to run over into
// the tool constructor.
- ClangTool Tool(OptionsParser.GetCompilations(), Sources);
+ ClangTool Tool(OptionsParser.getCompilations(), Sources);
// The ClangTool needs a new FrontendAction for each translation unit we run
// on. Thus, it takes a FrontendActionFactory as parameter. To create a
@@ -125,8 +125,8 @@
int main(int argc, const char **argv) {
CommonOptionsParser OptionsParser(argc, argv);
- ClangTool Tool(OptionsParser.GetCompilations(),
- OptionsParser.GetSourcePathList());
+ ClangTool Tool(OptionsParser.getCompilations(),
+ OptionsParser.getSourcePathList());
return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>());
}
diff --git a/include/clang/Tooling/CommonOptionsParser.h b/include/clang/Tooling/CommonOptionsParser.h
index a1bad12..d313773 100644
--- a/include/clang/Tooling/CommonOptionsParser.h
+++ b/include/clang/Tooling/CommonOptionsParser.h
@@ -53,8 +53,8 @@
///
/// int main(int argc, const char **argv) {
/// CommonOptionsParser OptionsParser(argc, argv);
-/// ClangTool Tool(OptionsParser.GetCompilations(),
-/// OptionsParser.GetSourcePathListi());
+/// ClangTool Tool(OptionsParser.getCompilations(),
+/// OptionsParser.getSourcePathListi());
/// return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>());
/// }
/// \endcode
@@ -67,12 +67,12 @@
CommonOptionsParser(int &argc, const char **argv);
/// Returns a reference to the loaded compilations database.
- CompilationDatabase &GetCompilations() {
+ CompilationDatabase &getCompilations() {
return *Compilations;
}
/// Returns a list of source file paths to process.
- std::vector<std::string> GetSourcePathList() {
+ std::vector<std::string> getSourcePathList() {
return SourcePathList;
}
diff --git a/lib/Tooling/CommonOptionsParser.cpp b/lib/Tooling/CommonOptionsParser.cpp
index 15091c7..99aff9f 100644
--- a/lib/Tooling/CommonOptionsParser.cpp
+++ b/lib/Tooling/CommonOptionsParser.cpp
@@ -38,8 +38,8 @@
"\tFor example, it can be a CMake build directory in which a file named\n"
"\tcompile_commands.json exists (use -DCMAKE_EXPORT_COMPILE_COMMANDS=ON\n"
"\tCMake option to get this output). When no build path is specified,\n"
- "\tclang-check will attempt to locate it automatically using all parent\n"
- "\tpaths of the first input file. See:\n"
+ "\ta search for compile_commands.json will be attempted through all\n"
+ "\tparent paths of the first input file . See:\n"
"\thttp://clang.llvm.org/docs/HowToSetupToolingForLLVM.html for an\n"
"\texample of setting up Clang Tooling on a source tree.\n"
"\n"
diff --git a/tools/clang-check/ClangCheck.cpp b/tools/clang-check/ClangCheck.cpp
index 6c081ac..6f62228 100644
--- a/tools/clang-check/ClangCheck.cpp
+++ b/tools/clang-check/ClangCheck.cpp
@@ -143,8 +143,8 @@
int main(int argc, const char **argv) {
CommonOptionsParser OptionsParser(argc, argv);
- ClangTool Tool(OptionsParser.GetCompilations(),
- OptionsParser.GetSourcePathList());
+ ClangTool Tool(OptionsParser.getCompilations(),
+ OptionsParser.getSourcePathList());
if (Fixit)
return Tool.run(newFrontendActionFactory<FixItAction>());
clang_check::ClangCheckActionFactory Factory;