diff options
author | Rui Ueyama <ruiu@google.com> | 2013-08-06 22:31:59 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2013-08-06 22:31:59 +0000 |
commit | 0ca149fce901456eca05ac5244a816303974db03 (patch) | |
tree | d10916d0f49f34b6533c73c11e9b52b91ab98b68 /lld/unittests/DriverTests/WinLinkDriverTest.cpp | |
parent | 6fea779c2965b233425c9d4a6e7ff745ddd62b4e (diff) | |
download | bcm5719-llvm-0ca149fce901456eca05ac5244a816303974db03.tar.gz bcm5719-llvm-0ca149fce901456eca05ac5244a816303974db03.zip |
Rename TargetInfo -> LinkingContext.
Also change some local variable names: "ti" -> "context" and
"_targetInfo" -> "_context".
Differential Revision: http://llvm-reviews.chandlerc.com/D1301
llvm-svn: 187823
Diffstat (limited to 'lld/unittests/DriverTests/WinLinkDriverTest.cpp')
-rw-r--r-- | lld/unittests/DriverTests/WinLinkDriverTest.cpp | 99 |
1 files changed, 49 insertions, 50 deletions
diff --git a/lld/unittests/DriverTests/WinLinkDriverTest.cpp b/lld/unittests/DriverTests/WinLinkDriverTest.cpp index d32f22259b4..d048c89c1d2 100644 --- a/lld/unittests/DriverTests/WinLinkDriverTest.cpp +++ b/lld/unittests/DriverTests/WinLinkDriverTest.cpp @@ -14,7 +14,7 @@ #include "DriverTest.h" -#include "lld/ReaderWriter/PECOFFTargetInfo.h" +#include "lld/ReaderWriter/PECOFFLinkingContext.h" #include "llvm/Support/COFF.h" #include <vector> @@ -24,58 +24,57 @@ using namespace lld; namespace { -class WinLinkParserTest : public ParserTest<WinLinkDriver, PECOFFTargetInfo> { +class WinLinkParserTest + : public ParserTest<WinLinkDriver, PECOFFLinkingContext> { protected: - virtual const TargetInfo *targetInfo() { - return &_info; - } + virtual const LinkingContext *linkingContext() { return &_context; } }; TEST_F(WinLinkParserTest, Basic) { EXPECT_FALSE(parse("link.exe", "/subsystem:console", "/out:a.exe", "-entry:_start", "a.obj", "b.obj", "c.obj", nullptr)); - EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_CUI, _info.getSubsystem()); - EXPECT_EQ("a.exe", _info.outputPath()); - EXPECT_EQ("_start", _info.entrySymbolName()); + EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_CUI, _context.getSubsystem()); + EXPECT_EQ("a.exe", _context.outputPath()); + EXPECT_EQ("_start", _context.entrySymbolName()); EXPECT_EQ(3, inputFileCount()); EXPECT_EQ("a.obj", inputFile(0)); EXPECT_EQ("b.obj", inputFile(1)); EXPECT_EQ("c.obj", inputFile(2)); - EXPECT_TRUE(_info.getInputSearchPaths().empty()); + EXPECT_TRUE(_context.getInputSearchPaths().empty()); // Unspecified flags will have default values. - EXPECT_EQ(6, _info.getMinOSVersion().majorVersion); - EXPECT_EQ(0, _info.getMinOSVersion().minorVersion); - EXPECT_EQ(0x400000U, _info.getBaseAddress()); - EXPECT_EQ(1024 * 1024U, _info.getStackReserve()); - EXPECT_EQ(4096U, _info.getStackCommit()); - EXPECT_FALSE(_info.allowRemainingUndefines()); - EXPECT_TRUE(_info.isNxCompat()); - EXPECT_FALSE(_info.getLargeAddressAware()); - EXPECT_TRUE(_info.getBaseRelocationEnabled()); - EXPECT_TRUE(_info.isTerminalServerAware()); - EXPECT_TRUE(_info.initialUndefinedSymbols().empty()); + EXPECT_EQ(6, _context.getMinOSVersion().majorVersion); + EXPECT_EQ(0, _context.getMinOSVersion().minorVersion); + EXPECT_EQ(0x400000U, _context.getBaseAddress()); + EXPECT_EQ(1024 * 1024U, _context.getStackReserve()); + EXPECT_EQ(4096U, _context.getStackCommit()); + EXPECT_FALSE(_context.allowRemainingUndefines()); + EXPECT_TRUE(_context.isNxCompat()); + EXPECT_FALSE(_context.getLargeAddressAware()); + EXPECT_TRUE(_context.getBaseRelocationEnabled()); + EXPECT_TRUE(_context.isTerminalServerAware()); + EXPECT_TRUE(_context.initialUndefinedSymbols().empty()); } TEST_F(WinLinkParserTest, UnixStyleOption) { EXPECT_FALSE(parse("link.exe", "-subsystem", "console", "-out", "a.exe", "a.obj", nullptr)); - EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_CUI, _info.getSubsystem()); - EXPECT_EQ("a.exe", _info.outputPath()); + EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_CUI, _context.getSubsystem()); + EXPECT_EQ("a.exe", _context.outputPath()); EXPECT_EQ(1, inputFileCount()); EXPECT_EQ("a.obj", inputFile(0)); } TEST_F(WinLinkParserTest, Mllvm) { EXPECT_FALSE(parse("link.exe", "-mllvm", "-debug", "a.obj", nullptr)); - const std::vector<const char *> &options = _info.llvmOptions(); + const std::vector<const char *> &options = _context.llvmOptions(); EXPECT_EQ(1U, options.size()); EXPECT_EQ("-debug", options[0]); } TEST_F(WinLinkParserTest, NoFileExtension) { EXPECT_FALSE(parse("link.exe", "foo", "bar", nullptr)); - EXPECT_EQ("foo.exe", _info.outputPath()); + EXPECT_EQ("foo.exe", _context.outputPath()); EXPECT_EQ(2, inputFileCount()); EXPECT_EQ("foo.obj", inputFile(0)); EXPECT_EQ("bar.obj", inputFile(1)); @@ -83,7 +82,7 @@ TEST_F(WinLinkParserTest, NoFileExtension) { TEST_F(WinLinkParserTest, NonStandardFileExtension) { EXPECT_FALSE(parse("link.exe", "foo.o", nullptr)); - EXPECT_EQ("foo.exe", _info.outputPath()); + EXPECT_EQ("foo.exe", _context.outputPath()); EXPECT_EQ(1, inputFileCount()); EXPECT_EQ("foo.o", inputFile(0)); } @@ -91,7 +90,7 @@ TEST_F(WinLinkParserTest, NonStandardFileExtension) { TEST_F(WinLinkParserTest, Libpath) { EXPECT_FALSE(parse("link.exe", "/libpath:dir1", "/libpath:dir2", "a.obj", nullptr)); - const std::vector<StringRef> &paths = _info.getInputSearchPaths(); + const std::vector<StringRef> &paths = _context.getInputSearchPaths(); EXPECT_EQ(2U, paths.size()); EXPECT_EQ("dir1", paths[0]); EXPECT_EQ("dir2", paths[1]); @@ -99,16 +98,16 @@ TEST_F(WinLinkParserTest, Libpath) { TEST_F(WinLinkParserTest, MinMajorOSVersion) { EXPECT_FALSE(parse("link.exe", "/subsystem:windows,3", "foo.o", nullptr)); - EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_GUI, _info.getSubsystem()); - EXPECT_EQ(3, _info.getMinOSVersion().majorVersion); - EXPECT_EQ(0, _info.getMinOSVersion().minorVersion); + EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_GUI, _context.getSubsystem()); + EXPECT_EQ(3, _context.getMinOSVersion().majorVersion); + EXPECT_EQ(0, _context.getMinOSVersion().minorVersion); } TEST_F(WinLinkParserTest, MinMajorMinorOSVersion) { EXPECT_FALSE(parse("link.exe", "/subsystem:windows,3.1", "foo.o", nullptr)); - EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_GUI, _info.getSubsystem()); - EXPECT_EQ(3, _info.getMinOSVersion().majorVersion); - EXPECT_EQ(1, _info.getMinOSVersion().minorVersion); + EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_GUI, _context.getSubsystem()); + EXPECT_EQ(3, _context.getMinOSVersion().majorVersion); + EXPECT_EQ(1, _context.getMinOSVersion().minorVersion); } TEST_F(WinLinkParserTest, DefaultLib) { @@ -122,76 +121,76 @@ TEST_F(WinLinkParserTest, DefaultLib) { TEST_F(WinLinkParserTest, Base) { EXPECT_FALSE(parse("link.exe", "/base:8388608", "a.obj", nullptr)); - EXPECT_EQ(0x800000U, _info.getBaseAddress()); + EXPECT_EQ(0x800000U, _context.getBaseAddress()); } TEST_F(WinLinkParserTest, StackReserve) { EXPECT_FALSE(parse("link.exe", "/stack:8192", "a.obj", nullptr)); - EXPECT_EQ(8192U, _info.getStackReserve()); - EXPECT_EQ(4096U, _info.getStackCommit()); + EXPECT_EQ(8192U, _context.getStackReserve()); + EXPECT_EQ(4096U, _context.getStackCommit()); } TEST_F(WinLinkParserTest, StackReserveAndCommit) { EXPECT_FALSE(parse("link.exe", "/stack:16384,8192", "a.obj", nullptr)); - EXPECT_EQ(16384U, _info.getStackReserve()); - EXPECT_EQ(8192U, _info.getStackCommit()); + EXPECT_EQ(16384U, _context.getStackReserve()); + EXPECT_EQ(8192U, _context.getStackCommit()); } TEST_F(WinLinkParserTest, HeapReserve) { EXPECT_FALSE(parse("link.exe", "/heap:8192", "a.obj", nullptr)); - EXPECT_EQ(8192U, _info.getHeapReserve()); - EXPECT_EQ(4096U, _info.getHeapCommit()); + EXPECT_EQ(8192U, _context.getHeapReserve()); + EXPECT_EQ(4096U, _context.getHeapCommit()); } TEST_F(WinLinkParserTest, HeapReserveAndCommit) { EXPECT_FALSE(parse("link.exe", "/heap:16384,8192", "a.obj", nullptr)); - EXPECT_EQ(16384U, _info.getHeapReserve()); - EXPECT_EQ(8192U, _info.getHeapCommit()); + EXPECT_EQ(16384U, _context.getHeapReserve()); + EXPECT_EQ(8192U, _context.getHeapCommit()); } TEST_F(WinLinkParserTest, Force) { EXPECT_FALSE(parse("link.exe", "/force", "a.obj", nullptr)); - EXPECT_TRUE(_info.allowRemainingUndefines()); + EXPECT_TRUE(_context.allowRemainingUndefines()); } TEST_F(WinLinkParserTest, NoNxCompat) { EXPECT_FALSE(parse("link.exe", "/nxcompat:no", "a.obj", nullptr)); - EXPECT_FALSE(_info.isNxCompat()); + EXPECT_FALSE(_context.isNxCompat()); } TEST_F(WinLinkParserTest, LargeAddressAware) { EXPECT_FALSE(parse("link.exe", "/largeaddressaware", "a.obj", nullptr)); - EXPECT_TRUE(_info.getLargeAddressAware()); + EXPECT_TRUE(_context.getLargeAddressAware()); } TEST_F(WinLinkParserTest, NoLargeAddressAware) { EXPECT_FALSE(parse("link.exe", "/largeaddressaware:no", "a.obj", nullptr)); - EXPECT_FALSE(_info.getLargeAddressAware()); + EXPECT_FALSE(_context.getLargeAddressAware()); } TEST_F(WinLinkParserTest, Fixed) { EXPECT_FALSE(parse("link.exe", "/fixed", "a.out", nullptr)); - EXPECT_FALSE(_info.getBaseRelocationEnabled()); + EXPECT_FALSE(_context.getBaseRelocationEnabled()); } TEST_F(WinLinkParserTest, NoFixed) { EXPECT_FALSE(parse("link.exe", "/fixed:no", "a.out", nullptr)); - EXPECT_TRUE(_info.getBaseRelocationEnabled()); + EXPECT_TRUE(_context.getBaseRelocationEnabled()); } TEST_F(WinLinkParserTest, TerminalServerAware) { EXPECT_FALSE(parse("link.exe", "/tsaware", "a.out", nullptr)); - EXPECT_TRUE(_info.isTerminalServerAware()); + EXPECT_TRUE(_context.isTerminalServerAware()); } TEST_F(WinLinkParserTest, NoTerminalServerAware) { EXPECT_FALSE(parse("link.exe", "/tsaware:no", "a.out", nullptr)); - EXPECT_FALSE(_info.isTerminalServerAware()); + EXPECT_FALSE(_context.isTerminalServerAware()); } TEST_F(WinLinkParserTest, Include) { EXPECT_FALSE(parse("link.exe", "/include:foo", "a.out", nullptr)); - auto symbols = _info.initialUndefinedSymbols(); + auto symbols = _context.initialUndefinedSymbols(); EXPECT_FALSE(symbols.empty()); EXPECT_EQ("foo", symbols[0]); symbols.pop_front(); |