[lld] r187683 - [PECOFF] Remove special treatment of "--" option.

Rui Ueyama ruiu at google.com
Fri Aug 2 15:34:12 PDT 2013


Author: ruiu
Date: Fri Aug  2 17:34:12 2013
New Revision: 187683

URL: http://llvm.org/viewvc/llvm-project?rev=187683&view=rev
Log:
[PECOFF] Remove special treatment of "--" option.

Thanks to Hans' patch (r187675), OptTable now handles "--", so we don't
need this code in LLD.

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=187683&r1=187682&r2=187683&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Fri Aug  2 17:34:12 2013
@@ -62,14 +62,6 @@ public:
   WinLinkOptTable() : OptTable(infoTable, llvm::array_lengthof(infoTable)){}
 };
 
-// Returns the index of "--" or -1 if not found.
-int findDoubleDash(int argc, const char *argv[]) {
-  for (int i = 0; i < argc; ++i)
-    if (std::strcmp(argv[i], "--") == 0)
-      return i;
-  return -1;
-}
-
 // Displays error message if the given version does not match with
 // /^\d+$/.
 bool checkNumber(StringRef version, const char *errorMessage,
@@ -318,15 +310,9 @@ bool WinLinkDriver::linkPECOFF(int argc,
 
 bool WinLinkDriver::parse(int argc, const char *argv[],
                           PECOFFTargetInfo &info, raw_ostream &diagnostics) {
-  // Arguments after "--" are interpreted as filenames even if they start with
-  // a hyphen or a slash. This is not compatible with link.exe but useful for
-  // us to test lld on Unix.
-  int doubleDashPosition = findDoubleDash(argc, argv);
-  int argEnd = (doubleDashPosition > 0) ? doubleDashPosition : argc;
-
   // Parse the options.
   std::unique_ptr<llvm::opt::InputArgList> parsedArgs = parseArgs(
-      argEnd, argv, diagnostics);
+      argc, argv, diagnostics);
   if (!parsedArgs)
     return true;
 
@@ -439,11 +425,6 @@ bool WinLinkDriver::parse(int argc, cons
     inputPaths.push_back((*it)->getValue());
   }
 
-  // Arguments after "--" are also input files
-  if (doubleDashPosition > 0)
-    for (int i = doubleDashPosition + 1; i < argc; ++i)
-      inputPaths.push_back(argv[i]);
-
   // Add input files specified via the command line.
   for (const StringRef path : inputPaths)
     info.appendInputFileOrLibrary(path);





More information about the llvm-commits mailing list