diff options
author | Marshall Clow <mclow@qualcomm.com> | 2012-08-07 17:58:49 +0000 |
---|---|---|
committer | Marshall Clow <mclow@qualcomm.com> | 2012-08-07 17:58:49 +0000 |
commit | d39041f2fc7c5734da8b5dede5caac23713e9236 (patch) | |
tree | 3de5dc89f12f29083a96e57c5f480057d9ba701d | |
parent | 740c0fbe0e025c4ae3ac4e08917816b96b8dbe32 (diff) | |
download | bcm5719-llvm-d39041f2fc7c5734da8b5dede5caac23713e9236.tar.gz bcm5719-llvm-d39041f2fc7c5734da8b5dede5caac23713e9236.zip |
Added code to let the user specify a compilation database on the command line
llvm-svn: 161432
-rw-r--r-- | clang-tools-extra/remove-cstr-calls/RemoveCStrCalls.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/clang-tools-extra/remove-cstr-calls/RemoveCStrCalls.cpp b/clang-tools-extra/remove-cstr-calls/RemoveCStrCalls.cpp index 963b28f889f..c9b16e02258 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<std::string> SourcePaths( cl::desc("<source0> [... <sourceN>]"), cl::OneOrMore); -int main(int argc, char **argv) { - cl::ParseCommandLineOptions(argc, argv); - std::string ErrorMessage; +int main(int argc, const char **argv) { llvm::OwningPtr<CompilationDatabase> 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()); |