[Tooling] Put createExecutorFromCommandLineArgs implementation in a wrapper. NFC

llvm-svn: 317328
This commit is contained in:
Eric Liu 2017-11-03 15:20:57 +00:00
parent a6a2910e3d
commit 6e6228477b
2 changed files with 20 additions and 3 deletions

View File

@ -162,6 +162,13 @@ createExecutorFromCommandLineArgs(int &argc, const char **argv,
llvm::cl::OptionCategory &Category,
const char *Overview = nullptr);
namespace internal {
llvm::Expected<std::unique_ptr<ToolExecutor>>
createExecutorFromCommandLineArgsImpl(int &argc, const char **argv,
llvm::cl::OptionCategory &Category,
const char *Overview = nullptr);
} // end namespace internal
} // end namespace tooling
} // end namespace clang

View File

@ -54,10 +54,11 @@ llvm::Error ToolExecutor::execute(std::unique_ptr<FrontendActionFactory> Action,
return execute(Actions);
}
namespace internal {
llvm::Expected<std::unique_ptr<ToolExecutor>>
createExecutorFromCommandLineArgs(int &argc, const char **argv,
llvm::cl::OptionCategory &Category,
const char *Overview) {
createExecutorFromCommandLineArgsImpl(int &argc, const char **argv,
llvm::cl::OptionCategory &Category,
const char *Overview) {
auto OptionsParser =
CommonOptionsParser::create(argc, argv, Category, llvm::cl::ZeroOrMore,
/*Overview=*/nullptr);
@ -84,6 +85,15 @@ createExecutorFromCommandLineArgs(int &argc, const char **argv,
llvm::Twine("Executor \"") + ExecutorName + "\" is not registered.",
llvm::inconvertibleErrorCode());
}
} // end namespace internal
llvm::Expected<std::unique_ptr<ToolExecutor>>
createExecutorFromCommandLineArgs(int &argc, const char **argv,
llvm::cl::OptionCategory &Category,
const char *Overview) {
return internal::createExecutorFromCommandLineArgsImpl(argc, argv, Category,
Overview);
}
} // end namespace tooling
} // end namespace clang