diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2019-09-04 14:26:28 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2019-09-04 14:26:28 +0000 |
commit | 433927595dde3821c76b33725aab8ccd472a5137 (patch) | |
tree | c43b08da79c34b273d3ddc64a1e0d809c68d64c2 /clang/lib/Tooling/InterpolatingCompilationDatabase.cpp | |
parent | cbf1f3b771c8c0e0858deafe5f9457fb838ff2c2 (diff) | |
download | bcm5719-llvm-433927595dde3821c76b33725aab8ccd472a5137.tar.gz bcm5719-llvm-433927595dde3821c76b33725aab8ccd472a5137.zip |
[Driver] Use shared singleton instance of DriverOptTable
Summary:
This significantly reduces the time required to run clangd tests, by
~10%.
Should also have an effect on other tests that run command-line parsing
multiple times inside a single invocation.
Reviewers: gribozavr, sammccall
Reviewed By: sammccall
Subscribers: kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67163
llvm-svn: 370908
Diffstat (limited to 'clang/lib/Tooling/InterpolatingCompilationDatabase.cpp')
-rw-r--r-- | clang/lib/Tooling/InterpolatingCompilationDatabase.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp index bdd34766a95..59b66abe65e 100644 --- a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp +++ b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp @@ -149,17 +149,17 @@ struct TransferableCommand { // We parse each argument individually so that we can retain the exact // spelling of each argument; re-rendering is lossy for aliased flags. // E.g. in CL mode, /W4 maps to -Wall. - auto OptTable = clang::driver::createDriverOptTable(); + auto &OptTable = clang::driver::getDriverOptTable(); if (!OldArgs.empty()) Cmd.CommandLine.emplace_back(OldArgs.front()); for (unsigned Pos = 1; Pos < OldArgs.size();) { using namespace driver::options; const unsigned OldPos = Pos; - std::unique_ptr<llvm::opt::Arg> Arg(OptTable->ParseOneArg( + std::unique_ptr<llvm::opt::Arg> Arg(OptTable.ParseOneArg( ArgList, Pos, - /* Include */ClangCLMode ? CoreOption | CLOption : 0, - /* Exclude */ClangCLMode ? 0 : CLOption)); + /* Include */ ClangCLMode ? CoreOption | CLOption : 0, + /* Exclude */ ClangCLMode ? 0 : CLOption)); if (!Arg) continue; |