[llvm-branch-commits] [cfe-branch] r332649 - Merging r330926:
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu May 17 11:55:19 PDT 2018
Author: tstellar
Date: Thu May 17 11:55:19 2018
New Revision: 332649
URL: http://llvm.org/viewvc/llvm-project?rev=332649&view=rev
Log:
Merging r330926:
------------------------------------------------------------------------
r330926 | sepavloff | 2018-04-25 23:28:47 -0700 (Wed, 25 Apr 2018) | 9 lines
[ConfigFiles] Update argument strings when merging argrument lists
Implementation of `InputArgList` assumes its field `ArgStrings` contains
strings for each argument exactly in the same order. This condition was
broken when arguments from config file and from invocation were merged.
This change fixes https://bugs.llvm.org/show_bug.cgi?id=37196 (Clang
config files can crash argument handling).
------------------------------------------------------------------------
Added:
cfe/branches/release_60/test/Driver/Inputs/empty.cfg
cfe/branches/release_60/test/Driver/config-file4.c
Modified:
cfe/branches/release_60/lib/Driver/Driver.cpp
Modified: cfe/branches/release_60/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/lib/Driver/Driver.cpp?rev=332649&r1=332648&r2=332649&view=diff
==============================================================================
--- cfe/branches/release_60/lib/Driver/Driver.cpp (original)
+++ cfe/branches/release_60/lib/Driver/Driver.cpp Thu May 17 11:55:19 2018
@@ -858,11 +858,14 @@ Compilation *Driver::BuildCompilation(Ar
: std::move(*CLOptions));
if (HasConfigFile)
for (auto *Opt : *CLOptions) {
+ if (Opt->getOption().matches(options::OPT_config))
+ continue;
+ unsigned Index = Args.MakeIndex(Opt->getSpelling());
const Arg *BaseArg = &Opt->getBaseArg();
if (BaseArg == Opt)
BaseArg = nullptr;
Arg *Copy = new llvm::opt::Arg(Opt->getOption(), Opt->getSpelling(),
- Args.size(), BaseArg);
+ Index, BaseArg);
Copy->getValues() = Opt->getValues();
if (Opt->isClaimed())
Copy->claim();
Added: cfe/branches/release_60/test/Driver/Inputs/empty.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/test/Driver/Inputs/empty.cfg?rev=332649&view=auto
==============================================================================
(empty)
Added: cfe/branches/release_60/test/Driver/config-file4.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/test/Driver/config-file4.c?rev=332649&view=auto
==============================================================================
--- cfe/branches/release_60/test/Driver/config-file4.c (added)
+++ cfe/branches/release_60/test/Driver/config-file4.c Thu May 17 11:55:19 2018
@@ -0,0 +1,2 @@
+// RUN: %clang --config %S/Inputs/empty.cfg -Wall -Wextra -Wformat -Wstrict-aliasing -Wshadow -Wpacked -Winline -Wimplicit-function-declaration -c %s -O2 -o /dev/null -v 2>&1 | FileCheck %s -check-prefix PR37196
+// PR37196: Configuration file: {{.*}}/empty.cfg
More information about the llvm-branch-commits
mailing list