aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-09-04 14:26:28 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-09-04 14:26:28 +0000
commit433927595dde3821c76b33725aab8ccd472a5137 (patch)
treec43b08da79c34b273d3ddc64a1e0d809c68d64c2 /clang/lib/Frontend/CompilerInvocation.cpp
parentcbf1f3b771c8c0e0858deafe5f9457fb838ff2c2 (diff)
downloadllvm-433927595dde3821c76b33725aab8ccd472a5137.zip
llvm-433927595dde3821c76b33725aab8ccd472a5137.tar.gz
llvm-433927595dde3821c76b33725aab8ccd472a5137.tar.bz2
[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/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 86c66f3..711f7df 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/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)