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 | f521f90c4479af43412ed1125fd33a8f332083fe (patch) | |
tree | 27ac6793c01f7431fd1480204a40cc0d5bf0d8a5 /lib/Frontend/CompilerInvocation.cpp | |
parent | 4d178a6e93cda6c8ad640d4b52002c594ad4d69e (diff) | |
download | clang-f521f90c4479af43412ed1125fd33a8f332083fe.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370908 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 86c66f3a07..711f7dfa65 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -3375,11 +3375,11 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, bool Success = true; // Parse the arguments. - std::unique_ptr<OptTable> Opts = createDriverOptTable(); + const OptTable &Opts = getDriverOptTable(); const unsigned IncludedFlagsBitmask = options::CC1Option; unsigned MissingArgIndex, MissingArgCount; - InputArgList Args = Opts->ParseArgs(CommandLineArgs, MissingArgIndex, - MissingArgCount, IncludedFlagsBitmask); + InputArgList Args = Opts.ParseArgs(CommandLineArgs, MissingArgIndex, + MissingArgCount, IncludedFlagsBitmask); LangOptions &LangOpts = *Res.getLangOpts(); // Check for missing argument error. @@ -3393,7 +3393,7 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, for (const auto *A : Args.filtered(OPT_UNKNOWN)) { auto ArgString = A->getAsString(Args); std::string Nearest; - if (Opts->findNearest(ArgString, Nearest, IncludedFlagsBitmask) > 1) + if (Opts.findNearest(ArgString, Nearest, IncludedFlagsBitmask) > 1) Diags.Report(diag::err_drv_unknown_argument) << ArgString; else Diags.Report(diag::err_drv_unknown_argument_with_suggestion) |