summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2019-08-27 22:13:31 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2019-08-27 22:13:31 +0000
commit1fac68b0dc19b03fd2c5e9856f0f2c5a11691348 (patch)
tree8d34e81ec9a2821e079ca8f647d6d1c82c5309f6 /clang/lib
parentd3136661bac0509328231005957fb27adc8ce717 (diff)
downloadbcm5719-llvm-1fac68b0dc19b03fd2c5e9856f0f2c5a11691348.tar.gz
bcm5719-llvm-1fac68b0dc19b03fd2c5e9856f0f2c5a11691348.zip
ArrayRef'ized CompilerInvocation::CreateFromArgs
Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66797 llvm-svn: 370122
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp8
-rw-r--r--clang/lib/Frontend/CreateInvocationFromCommandLine.cpp4
-rw-r--r--clang/lib/Tooling/Tooling.cpp4
3 files changed, 5 insertions, 11 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 0e222b95dde..86c66f3a07a 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3370,8 +3370,7 @@ static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args,
}
bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
- const char *const *ArgBegin,
- const char *const *ArgEnd,
+ ArrayRef<const char *> CommandLineArgs,
DiagnosticsEngine &Diags) {
bool Success = true;
@@ -3379,9 +3378,8 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
std::unique_ptr<OptTable> Opts = createDriverOptTable();
const unsigned IncludedFlagsBitmask = options::CC1Option;
unsigned MissingArgIndex, MissingArgCount;
- InputArgList Args =
- Opts->ParseArgs(llvm::makeArrayRef(ArgBegin, ArgEnd), MissingArgIndex,
- MissingArgCount, IncludedFlagsBitmask);
+ InputArgList Args = Opts->ParseArgs(CommandLineArgs, MissingArgIndex,
+ MissingArgCount, IncludedFlagsBitmask);
LangOptions &LangOpts = *Res.getLangOpts();
// Check for missing argument error.
diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
index ea7de7a4111..ab62b633cda 100644
--- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
+++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
@@ -90,9 +90,7 @@ std::unique_ptr<CompilerInvocation> clang::createInvocationFromCommandLine(
const ArgStringList &CCArgs = Cmd.getArguments();
auto CI = std::make_unique<CompilerInvocation>();
- if (!CompilerInvocation::CreateFromArgs(
- *CI, const_cast<const char **>(CCArgs.data()),
- const_cast<const char **>(CCArgs.data()) + CCArgs.size(), *Diags) &&
+ if (!CompilerInvocation::CreateFromArgs(*CI, CCArgs, *Diags) &&
!ShouldRecoverOnErorrs)
return nullptr;
return CI;
diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp
index 291df0ae333..b21fc33ac39 100644
--- a/clang/lib/Tooling/Tooling.cpp
+++ b/clang/lib/Tooling/Tooling.cpp
@@ -118,9 +118,7 @@ CompilerInvocation *newInvocation(
DiagnosticsEngine *Diagnostics, const llvm::opt::ArgStringList &CC1Args) {
assert(!CC1Args.empty() && "Must at least contain the program name!");
CompilerInvocation *Invocation = new CompilerInvocation;
- CompilerInvocation::CreateFromArgs(
- *Invocation, CC1Args.data() + 1, CC1Args.data() + CC1Args.size(),
- *Diagnostics);
+ CompilerInvocation::CreateFromArgs(*Invocation, CC1Args, *Diagnostics);
Invocation->getFrontendOpts().DisableFree = false;
Invocation->getCodeGenOpts().DisableFree = false;
return Invocation;
OpenPOWER on IntegriCloud