Only add common tool options when CommonOptionsParser is used.
Summary: Subj.
Reviewers: chandlerc, klimek, djasper
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D29
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162798 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Tooling/CommonOptionsParser.cpp b/lib/Tooling/CommonOptionsParser.cpp
index 2c81757..15091c7 100644
--- a/lib/Tooling/CommonOptionsParser.cpp
+++ b/lib/Tooling/CommonOptionsParser.cpp
@@ -53,13 +53,13 @@
"\tsuffix of a path in the compile command database.\n"
"\n";
-static cl::opt<std::string> BuildPath(
- "p", cl::desc("Build path"), cl::Optional);
-
-static cl::list<std::string> SourcePaths(
- cl::Positional, cl::desc("<source0> [... <sourceN>]"), cl::OneOrMore);
-
CommonOptionsParser::CommonOptionsParser(int &argc, const char **argv) {
+ static cl::opt<std::string> BuildPath(
+ "p", cl::desc("Build path"), cl::Optional);
+
+ static cl::list<std::string> SourcePaths(
+ cl::Positional, cl::desc("<source0> [... <sourceN>]"), cl::OneOrMore);
+
Compilations.reset(FixedCompilationDatabase::loadFromCommandLine(argc,
argv));
cl::ParseCommandLineOptions(argc, argv);