[PATCH] D109361: [clang][Driver] Pick the last --driver-mode in case of multiple ones
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 7 06:34:03 PDT 2021
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG73c00d40bd49: [clang][Driver] Pick the last --driver-mode in case of multiple ones (authored by kadircet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109361/new/
https://reviews.llvm.org/D109361
Files:
clang/lib/Driver/Driver.cpp
clang/unittests/Driver/ToolChainTest.cpp
Index: clang/unittests/Driver/ToolChainTest.cpp
===================================================================
--- clang/unittests/Driver/ToolChainTest.cpp
+++ clang/unittests/Driver/ToolChainTest.cpp
@@ -16,6 +16,7 @@
#include "clang/Basic/LLVM.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/VirtualFileSystem.h"
@@ -357,4 +358,10 @@
EXPECT_TRUE(CallbackHasCalled);
}
+TEST(GetDriverMode, PrefersLastDriverMode) {
+ static constexpr const char *Args[] = {"clang-cl", "--driver-mode=foo",
+ "--driver-mode=bar", "foo.cpp"};
+ EXPECT_EQ(getDriverMode(Args[0], llvm::makeArrayRef(Args).slice(1)), "bar");
+}
+
} // end anonymous namespace.
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -5569,7 +5569,6 @@
if (!Arg.startswith(OptName))
continue;
Opt = Arg;
- break;
}
if (Opt.empty())
Opt = ToolChain::getTargetAndModeFromProgramName(ProgName).DriverMode;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109361.371061.patch
Type: text/x-patch
Size: 1230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210907/067e2a70/attachment.bin>
More information about the cfe-commits
mailing list