[lld] r194545 - [PECOFF] Fix use-after-return.

Rui Ueyama ruiu at google.com
Tue Nov 12 18:21:51 PST 2013


Author: ruiu
Date: Tue Nov 12 20:21:51 2013
New Revision: 194545

URL: http://llvm.org/viewvc/llvm-project?rev=194545&view=rev
Log:
[PECOFF] Fix use-after-return.

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=194545&r1=194544&r2=194545&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Tue Nov 12 20:21:51 2013
@@ -842,7 +842,7 @@ WinLinkDriver::parse(int argc, const cha
 
     case OPT_INPUT:
       inputElements.push_back(std::unique_ptr<InputElement>(
-          new PECOFFFileNode(ctx, inputArg->getValue())));
+          new PECOFFFileNode(ctx, ctx.allocateString(inputArg->getValue()))));
       break;
 
 #define DEFINE_BOOLEAN_FLAG(name, setter)       \
@@ -892,9 +892,11 @@ WinLinkDriver::parse(int argc, const cha
   // start with a hypen or a slash. This is not compatible with link.exe
   // but useful for us to test lld on Unix.
   if (llvm::opt::Arg *dashdash = parsedArgs->getLastArg(OPT_DASH_DASH)) {
-    for (const StringRef value : dashdash->getValues())
-      inputElements.push_back(
-          std::unique_ptr<InputElement>(new PECOFFFileNode(ctx, value)));
+    for (const StringRef value : dashdash->getValues()) {
+      std::unique_ptr<InputElement> elem(
+          new PECOFFFileNode(ctx, ctx.allocateString(value)));
+      inputElements.push_back(std::move(elem));
+    }
   }
 
   // Add the libraries specified by /defaultlib unless they are already added





More information about the llvm-commits mailing list