diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Tooling/Tooling.cpp | 4 |
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; |

