diff --git a/clang-tools-extra/remove-cstr-calls/RemoveCStrCalls.cpp b/clang-tools-extra/remove-cstr-calls/RemoveCStrCalls.cpp index 963b28f889f9..c9b16e022589 100644 --- a/clang-tools-extra/remove-cstr-calls/RemoveCStrCalls.cpp +++ b/clang-tools-extra/remove-cstr-calls/RemoveCStrCalls.cpp @@ -176,13 +176,17 @@ cl::list SourcePaths( cl::desc(" [... ]"), cl::OneOrMore); -int main(int argc, char **argv) { - cl::ParseCommandLineOptions(argc, argv); - std::string ErrorMessage; +int main(int argc, const char **argv) { llvm::OwningPtr Compilations( - CompilationDatabase::loadFromDirectory(BuildPath, ErrorMessage)); - if (!Compilations) - llvm::report_fatal_error(ErrorMessage); + tooling::FixedCompilationDatabase::loadFromCommandLine(argc, argv)); + cl::ParseCommandLineOptions(argc, argv); + if (!Compilations) { + std::string ErrorMessage; + Compilations.reset( + CompilationDatabase::loadFromDirectory(BuildPath, ErrorMessage)); + if (!Compilations) + llvm::report_fatal_error(ErrorMessage); + } tooling::RefactoringTool Tool(*Compilations, SourcePaths); ast_matchers::MatchFinder Finder; FixCStrCall Callback(&Tool.getReplacements());