summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/lib/Driver/GnuLdDriver.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/lld/lib/Driver/GnuLdDriver.cpp b/lld/lib/Driver/GnuLdDriver.cpp
index 3358626bee2..d37d56d1205 100644
--- a/lld/lib/Driver/GnuLdDriver.cpp
+++ b/lld/lib/Driver/GnuLdDriver.cpp
@@ -103,16 +103,11 @@ maybeExpandResponseFiles(int argc, const char **argv, BumpPtrAllocator &alloc) {
DriverStringSaver saver(alloc);
llvm::cl::ExpandResponseFiles(saver, llvm::cl::TokenizeGNUCommandLine, smallvec);
- // Pack the results to a C-array.
+ // Pack the results to a C-array and return it.
argc = smallvec.size();
- std::vector<const char *> result;
- for (size_t i = 0, e = smallvec.size(); i < e; ++i)
- result.push_back(smallvec[i]);
- result.push_back(nullptr); // terminate ARGV with NULL
-
- // Allocate memory for the result and return it.
const char **copy = alloc.Allocate<const char *>(argc + 1);
std::copy(smallvec.begin(), smallvec.end(), copy);
+ copy[argc] = nullptr;
return std::make_tuple(argc, copy);
}
OpenPOWER on IntegriCloud