]> granicus.if.org Git - clang/commitdiff
Make joined instances of JoinedOrSeparate flags point to the unaliased args, like...
authorNico Weber <nicolasweber@gmx.de>
Fri, 5 Jul 2019 11:45:24 +0000 (11:45 +0000)
committerNico Weber <nicolasweber@gmx.de>
Fri, 5 Jul 2019 11:45:24 +0000 (11:45 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365186 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp

index 2201dcde49139ce95e8db1a0297e9dbe98d42d05..f2d0f6ce14e338c1135e0ebe3e1c33b7a9e165cc 100644 (file)
@@ -2180,7 +2180,7 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args,
         Diag(clang::diag::err_drv_unknown_language) << A->getValue();
         InputType = types::TY_Object;
       }
-    } else if (A->getOption().getID() == options::OPT__SLASH_U) {
+    } else if (A->getOption().getID() == options::OPT_U) {
       assert(A->getNumValues() == 1 && "The /U option has one value.");
       StringRef Val = A->getValue(0);
       if (Val.find_first_of("/\\") != StringRef::npos) {