diff options
author | Rui Ueyama <ruiu@google.com> | 2016-02-28 19:50:14 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-02-28 19:50:14 +0000 |
commit | 1099a47f345891e758f7a42ab07dbfca0969f9cc (patch) | |
tree | 69ae3bffb3b0b0d98c882c8b40da7a63a4feffda /lld/unittests | |
parent | d90c6af4b4637fca6329aab3fb36b49b9b832e02 (diff) |
Move functionality of UniversalDriver to the entry point file.
UniversalDriver was used as a dispatcher to each platform-specific driver.
It had its own Options.td file. It was not just too much to parse only a
few options (we only want to parse -core, -flavor or argv[0]),
but also interpreted arguments too early. For example, if you invoke lld as
"lld -flavor gnu ... -help", then you'd get the UniversalDriver's help
message instead of GnuDriver's. This patch eliminates the use of Options
from the dispatcher.
http://reviews.llvm.org/D17686
Diffstat (limited to 'lld/unittests')
-rw-r--r-- | lld/unittests/DriverTests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lld/unittests/DriverTests/DarwinLdDriverTest.cpp | 9 | ||||
-rw-r--r-- | lld/unittests/DriverTests/UniversalDriverTest.cpp | 32 |
3 files changed, 0 insertions, 42 deletions
diff --git a/lld/unittests/DriverTests/CMakeLists.txt b/lld/unittests/DriverTests/CMakeLists.txt index 716b1019983..f85841d666e 100644 --- a/lld/unittests/DriverTests/CMakeLists.txt +++ b/lld/unittests/DriverTests/CMakeLists.txt @@ -1,5 +1,4 @@ add_lld_unittest(DriverTests - UniversalDriverTest.cpp DarwinLdDriverTest.cpp ) diff --git a/lld/unittests/DriverTests/DarwinLdDriverTest.cpp b/lld/unittests/DriverTests/DarwinLdDriverTest.cpp index 4b3bfe84f8c..9d5b36f2cc7 100644 --- a/lld/unittests/DriverTests/DarwinLdDriverTest.cpp +++ b/lld/unittests/DriverTests/DarwinLdDriverTest.cpp @@ -254,12 +254,3 @@ TEST_F(DarwinLdParserTest, deadStrippableDylibInvalidType) { EXPECT_FALSE(parse("ld", "-mark_dead_strippable_dylib", "a.o", "-arch", "i386", nullptr)); } - -TEST_F(DarwinLdParserTest, llvmOptions) { - EXPECT_TRUE(parse("ld", "-mllvm", "-enable-tbaa", "-mllvm", "-enable-misched", "a.o", - "-arch", "i386", nullptr)); - const std::vector<const char *> &options = _ctx.llvmOptions(); - EXPECT_EQ(options.size(), 2UL); - EXPECT_EQ(strcmp(options[0],"-enable-tbaa"), 0); - EXPECT_EQ(strcmp(options[1],"-enable-misched"), 0); -} diff --git a/lld/unittests/DriverTests/UniversalDriverTest.cpp b/lld/unittests/DriverTests/UniversalDriverTest.cpp deleted file mode 100644 index b15e2cbf879..00000000000 --- a/lld/unittests/DriverTests/UniversalDriverTest.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===- lld/unittest/UniversalDriverTest.cpp -------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// \brief Universal driver tests that depend on the value of argv[0]. -/// -//===----------------------------------------------------------------------===// - -#include "gtest/gtest.h" -#include "lld/Driver/Driver.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/Support/raw_ostream.h" - -using namespace llvm; -using namespace lld; - -TEST(UniversalDriver, flavor) { - const char *args[] = {"ld", "-flavor", "gnu"}; - - std::string diags; - raw_string_ostream os(diags); - UniversalDriver::link(args, os); - EXPECT_EQ(os.str().find("failed to determine driver flavor"), - std::string::npos); - EXPECT_NE(os.str().find("no input files"), std::string::npos); -} |