[lld] r193030 - Simplify WinLinkDriver. No functionality change.

Rui Ueyama ruiu at google.com
Fri Oct 18 20:34:01 PDT 2013


Author: ruiu
Date: Fri Oct 18 22:34:00 2013
New Revision: 193030

URL: http://llvm.org/viewvc/llvm-project?rev=193030&view=rev
Log:
Simplify WinLinkDriver. No functionality change.

Modified:
    lld/trunk/lib/Driver/WinLinkDriver.cpp

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=193030&r1=193029&r2=193030&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Fri Oct 18 22:34:00 2013
@@ -490,6 +490,9 @@ WinLinkDriver::parse(int argc, const cha
   // Use the default entry name if /entry option is not given.
   if (ctx.entrySymbolName().empty())
     ctx.setEntrySymbolName(getDefaultEntrySymbolName(ctx));
+  StringRef entry = ctx.entrySymbolName();
+  if (!entry.empty())
+    ctx.addInitialUndefinedSymbol(entry);
 
   // Specifying both /opt:ref and /opt:noref is an error.
   if (parsedArgs->getLastArg(OPT_ref) && parsedArgs->getLastArg(OPT_ref_no)) {
@@ -500,17 +503,9 @@ WinLinkDriver::parse(int argc, const cha
   // If dead-stripping is enabled, we need to add the entry symbol and
   // symbols given by /include to the dead strip root set, so that it
   // won't be removed from the output.
-  if (ctx.deadStrip()) {
-    StringRef entry = ctx.entrySymbolName();
-    if (!entry.empty()) {
-      ctx.addInitialUndefinedSymbol(entry);
-      ctx.addDeadStripRoot(entry);
-    }
-    for (const StringRef symbolName : ctx.initialUndefinedSymbols()) {
-      ctx.addInitialUndefinedSymbol(entry);
+  if (ctx.deadStrip())
+    for (const StringRef symbolName : ctx.initialUndefinedSymbols())
       ctx.addDeadStripRoot(symbolName);
-    }
-  }
 
   // Arguments after "--" are interpreted as filenames even if they
   // start with a hypen or a slash. This is not compatible with link.exe





More information about the llvm-commits mailing list