<div dir="ltr">It's a good idea. There will be no other formats besides exe and dll (if /DLL option is specified, it's set as DLL).</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 3, 2014 at 3:28 PM, Nick Kledzik <span dir="ltr"><<a href="mailto:kledzik@apple.com" target="_blank">kledzik@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Will there be other formats beside exe and dll? If not, wouldn't it be simpler to just have this be a bool (_isDLL)?<br>
<span class="HOEnZb"><font color="#888888"><br>
-Nick<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Jan 2, 2014, at 7:29 PM, Rui Ueyama wrote:<br>
> Author: ruiu<br>
> Date: Thu Jan 2 21:29:15 2014<br>
> New Revision: 198396<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=198396&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=198396&view=rev</a><br>
> Log:<br>
> Use scoped enum.<br>
><br>
> Modified:<br>
> lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h<br>
> lld/trunk/lib/Driver/WinLinkDriver.cpp<br>
> lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h<br>
> lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp<br>
> lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp<br>
><br>
> Modified: lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h?rev=198396&r1=198395&r2=198396&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h?rev=198396&r1=198395&r2=198396&view=diff</a><br>
> ==============================================================================<br>
> --- lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h (original)<br>
> +++ lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h Thu Jan 2 21:29:15 2014<br>
> @@ -46,7 +46,7 @@ public:<br>
> _terminalServerAware(true), _dynamicBaseEnabled(true),<br>
> _createManifest(true), _embedManifest(false), _manifestId(1),<br>
> _manifestLevel("'asInvoker'"), _manifestUiAccess("'false'"),<br>
> - _imageType(ImageType::IMAGE_EXE),<br>
> + _imageType(ImageType::exe),<br>
> _dosStub(llvm::makeArrayRef(DEFAULT_DOS_STUB)) {<br>
> setDeadStripping(true);<br>
> }<br>
> @@ -72,9 +72,9 @@ public:<br>
> /// \brief Casting support<br>
> static inline bool classof(const LinkingContext *info) { return true; }<br>
><br>
> - enum ImageType {<br>
> - IMAGE_EXE,<br>
> - IMAGE_DLL<br>
> + enum class ImageType {<br>
> + exe,<br>
> + dll<br>
> };<br>
><br>
> virtual Writer &writer() const;<br>
><br>
> Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=198396&r1=198395&r2=198396&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=198396&r1=198395&r2=198396&view=diff</a><br>
> ==============================================================================<br>
> --- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)<br>
> +++ lld/trunk/lib/Driver/WinLinkDriver.cpp Thu Jan 2 21:29:15 2014<br>
> @@ -571,7 +571,7 @@ void processLibEnv(PECOFFLinkingContext<br>
> // Returns a default entry point symbol name depending on context image type and<br>
> // subsystem. These default names are MS CRT compliant.<br>
> StringRef getDefaultEntrySymbolName(PECOFFLinkingContext &context) {<br>
> - if (context.getImageType() == PECOFFLinkingContext::ImageType::IMAGE_DLL)<br>
> + if (context.getImageType() == PECOFFLinkingContext::ImageType::dll)<br>
> return "_DllMainCRTStartup@12";<br>
> llvm::COFF::WindowsSubsystem subsystem = context.getSubsystem();<br>
> if (subsystem == llvm::COFF::WindowsSubsystem::IMAGE_SUBSYSTEM_WINDOWS_GUI)<br>
> @@ -726,7 +726,7 @@ WinLinkDriver::parse(int argc, const cha<br>
><br>
> case OPT_dll:<br>
> // Parse /dll command line option<br>
> - ctx.setImageType(PECOFFLinkingContext::IMAGE_DLL);<br>
> + ctx.setImageType(PECOFFLinkingContext::ImageType::dll);<br>
> // Default base address of a DLL is 0x10000000.<br>
> if (!parsedArgs->getLastArg(OPT_base))<br>
> ctx.setBaseAddress(0x10000000);<br>
><br>
> Modified: lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h?rev=198396&r1=198395&r2=198396&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h?rev=198396&r1=198395&r2=198396&view=diff</a><br>
> ==============================================================================<br>
> --- lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h (original)<br>
> +++ lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h Thu Jan 2 21:29:15 2014<br>
> @@ -41,7 +41,7 @@ public:<br>
> return;<br>
> }<br>
> }<br>
> - if (_ctx.getImageType() == PECOFFLinkingContext::IMAGE_DLL) {<br>
> + if (_ctx.getImageType() == PECOFFLinkingContext::ImageType::dll) {<br>
> _ctx.setSubsystem(WindowsSubsystem::IMAGE_SUBSYSTEM_WINDOWS_GUI);<br>
> return;<br>
> }<br>
><br>
> Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=198396&r1=198395&r2=198396&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=198396&r1=198395&r2=198396&view=diff</a><br>
> ==============================================================================<br>
> --- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)<br>
> +++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Thu Jan 2 21:29:15 2014<br>
> @@ -911,7 +911,8 @@ error_code PECOFFWriter::writeFile(const<br>
> applyAllRelocations(buffer->getBufferStart());<br>
> DEBUG(printAllAtomAddresses());<br>
><br>
> - if (_PECOFFLinkingContext.getImageType() == PECOFFLinkingContext::IMAGE_DLL)<br>
> + if (_PECOFFLinkingContext.getImageType() ==<br>
> + PECOFFLinkingContext::ImageType::dll)<br>
> writeImportLibrary(_PECOFFLinkingContext);<br>
><br>
> return buffer->commit();<br>
> @@ -983,7 +984,8 @@ void PECOFFWriter::setAddressOfEntryPoin<br>
> // PECOFF spec says that entry point for dll images is optional, in which<br>
> // case it must be set to 0.<br>
> if (_PECOFFLinkingContext.entrySymbolName().empty() &&<br>
> - _PECOFFLinkingContext.getImageType() == PECOFFLinkingContext::IMAGE_DLL) {<br>
> + _PECOFFLinkingContext.getImageType() ==<br>
> + PECOFFLinkingContext::ImageType::dll) {<br>
> peHeader->setAddressOfEntryPoint(0);<br>
> } else {<br>
> uint64_t entryPointAddress =<br>
><br>
> Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=198396&r1=198395&r2=198396&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=198396&r1=198395&r2=198396&view=diff</a><br>
> ==============================================================================<br>
> --- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)<br>
> +++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Thu Jan 2 21:29:15 2014<br>
> @@ -46,7 +46,7 @@ TEST_F(WinLinkParserTest, Basic) {<br>
> EXPECT_TRUE(_context.getInputSearchPaths().empty());<br>
><br>
> // Unspecified flags will have default values.<br>
> - EXPECT_EQ(PECOFFLinkingContext::IMAGE_EXE, _context.getImageType());<br>
> + EXPECT_EQ(PECOFFLinkingContext::ImageType::exe, _context.getImageType());<br>
> EXPECT_EQ(6, _context.getMinOSVersion().majorVersion);<br>
> EXPECT_EQ(0, _context.getMinOSVersion().minorVersion);<br>
> EXPECT_EQ(0x400000U, _context.getBaseAddress());<br>
> @@ -426,7 +426,7 @@ TEST_F(WinLinkParserTest, DisallowLib) {<br>
><br>
> TEST_F(WinLinkParserTest, NoEntry) {<br>
> EXPECT_TRUE(parse("link.exe", "/noentry", "/dll", "a.obj", nullptr));<br>
> - EXPECT_EQ(PECOFFLinkingContext::IMAGE_DLL, _context.getImageType());<br>
> + EXPECT_EQ(PECOFFLinkingContext::ImageType::dll, _context.getImageType());<br>
> EXPECT_EQ(0x10000000U, _context.getBaseAddress());<br>
> EXPECT_EQ("", _context.entrySymbolName());<br>
> }<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
</div></div></blockquote></div><br></div>