diff options
author | Nico Weber <nicolasweber@gmx.de> | 2019-07-05 11:45:24 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2019-07-05 11:45:24 +0000 |
commit | cf1a11ded21008c8b0db731b81bf70cf8606ae1f (patch) | |
tree | 3fd839c1495599400e3bb50f4b6999452f8ca036 /lld | |
parent | 1126f1a6de81fafb7f7d42056536f5fc91910434 (diff) | |
download | bcm5719-llvm-cf1a11ded21008c8b0db731b81bf70cf8606ae1f.tar.gz bcm5719-llvm-cf1a11ded21008c8b0db731b81bf70cf8606ae1f.zip |
Make joined instances of JoinedOrSeparate flags point to the unaliased args, like all other arg types do
This fixes an 8-year-old regression. r105763 made it so that aliases
always refer to the unaliased option – but it missed the "joined" branch
of JoinedOrSeparate flags. (r162231 then made the Args classes
non-virtual, and r169344 moved them from clang to llvm.)
Back then, there was no JoinedOrSeparate flag that was an alias, so it
wasn't observable. Now /U in CLCompatOptions is a JoinedOrSeparate alias
in clang, and warn_slash_u_filename incorrectly used the aliased arg id
(using the unaliased one isn't really a regression since that warning
checks if the undefined macro contains slash or backslash and only then
emits the warning – and no valid use will pass "-Ufoo/bar" or similar).
Also, lld has many JoinedOrSeparate aliases, and due to this bug it had
to explicitly call `getUnaliasedOption()` in a bunch of places, even
though that shouldn't be necessary by design. After this fix in Option,
these calls really don't have an effect any more, so remove them.
No intended behavior change.
(I accidentally fixed this bug while working on PR29106 but then
wondered why the warn_slash_u_filename broke. When I figured it out, I
thought it would make sense to land this in a separate commit.)
Differential Revision: https://reviews.llvm.org/D64156
llvm-svn: 365186
Diffstat (limited to 'lld')
-rw-r--r-- | lld/COFF/Driver.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/Driver.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/DriverUtils.cpp | 2 | ||||
-rw-r--r-- | lld/MinGW/Driver.cpp | 2 | ||||
-rw-r--r-- | lld/wasm/Driver.cpp | 4 |
5 files changed, 6 insertions, 6 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 413b1e7a30f..41571541518 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -332,7 +332,7 @@ void LinkerDriver::parseDirectives(InputFile *File) { } for (auto *Arg : Args) { - switch (Arg->getOption().getUnaliasedOption().getID()) { + switch (Arg->getOption().getID()) { case OPT_aligncomm: parseAligncomm(Arg->getValue()); break; diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index af5bd241bb8..65b4ad39bec 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -1112,7 +1112,7 @@ void LinkerDriver::createFiles(opt::InputArgList &Args) { // Iterate over argv to process input files and positional arguments. for (auto *Arg : Args) { - switch (Arg->getOption().getUnaliasedOption().getID()) { + switch (Arg->getOption().getID()) { case OPT_library: addLibrary(Arg->getValue()); break; diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp index e6a482b4969..e985a077f78 100644 --- a/lld/ELF/DriverUtils.cpp +++ b/lld/ELF/DriverUtils.cpp @@ -172,7 +172,7 @@ std::string elf::createResponseFile(const opt::InputArgList &Args) { // Copy the command line to the output while rewriting paths. for (auto *Arg : Args) { - switch (Arg->getOption().getUnaliasedOption().getID()) { + switch (Arg->getOption().getID()) { case OPT_reproduce: break; case OPT_INPUT: diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp index 57fed1a43af..979d3091f6a 100644 --- a/lld/MinGW/Driver.cpp +++ b/lld/MinGW/Driver.cpp @@ -313,7 +313,7 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) { StringRef Prefix = ""; bool Static = false; for (auto *A : Args) { - switch (A->getOption().getUnaliasedOption().getID()) { + switch (A->getOption().getID()) { case OPT_INPUT: if (StringRef(A->getValue()).endswith_lower(".def")) Add("-def:" + StringRef(A->getValue())); diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp index 307213e8d1b..1a286126871 100644 --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -271,7 +271,7 @@ void LinkerDriver::addLibrary(StringRef Name) { void LinkerDriver::createFiles(opt::InputArgList &Args) { for (auto *Arg : Args) { - switch (Arg->getOption().getUnaliasedOption().getID()) { + switch (Arg->getOption().getID()) { case OPT_l: addLibrary(Arg->getValue()); break; @@ -531,7 +531,7 @@ static std::string createResponseFile(const opt::InputArgList &Args) { // Copy the command line to the output while rewriting paths. for (auto *Arg : Args) { - switch (Arg->getOption().getUnaliasedOption().getID()) { + switch (Arg->getOption().getID()) { case OPT_reproduce: break; case OPT_INPUT: |