diff options
| author | Rui Ueyama <ruiu@google.com> | 2013-06-08 03:39:35 +0000 | 
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2013-06-08 03:39:35 +0000 | 
| commit | 7b5592bc0b75f04293768a92f4db01a703b82ce0 (patch) | |
| tree | aac84863b4a407b66a0af18faa82b2e23bd4fcb6 /lld/lib/Driver/WinLinkDriver.cpp | |
| parent | 0b5ca604a9475fe210451805d035119820f0e297 (diff) | |
| download | bcm5719-llvm-7b5592bc0b75f04293768a92f4db01a703b82ce0.tar.gz bcm5719-llvm-7b5592bc0b75f04293768a92f4db01a703b82ce0.zip | |
[WinLink] Fix use-after-return.
llvm-svn: 183603
Diffstat (limited to 'lld/lib/Driver/WinLinkDriver.cpp')
| -rw-r--r-- | lld/lib/Driver/WinLinkDriver.cpp | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp index 7bdbd4928a0..8730a9cc22e 100644 --- a/lld/lib/Driver/WinLinkDriver.cpp +++ b/lld/lib/Driver/WinLinkDriver.cpp @@ -127,19 +127,19 @@ bool parseSubsystemOption(PECOFFTargetInfo &info, std::string arg,  }  // Add ".obj" extension if the given path name has no file extension. -std::string canonicalizeInputFileName(std::string path) { +StringRef canonicalizeInputFileName(PECOFFTargetInfo &info, std::string path) {    if (llvm::sys::path::extension(path).empty()) -    return path.append(".obj"); -  return path; +    path.append(".obj"); +  return info.allocateString(path);  }  // Replace a file extension with ".exe". If the given file has no  // extension, just add ".exe". -std::string getDefaultOutputFileName(std::string path) { +StringRef getDefaultOutputFileName(PECOFFTargetInfo &info, std::string path) {    StringRef ext = llvm::sys::path::extension(path);    if (!ext.empty())      path.erase(path.size() - ext.size()); -  return path.append(".exe"); +  return info.allocateString(path.append(".exe"));  }  } // namespace @@ -223,12 +223,12 @@ bool WinLinkDriver::parse(int argc, const char *argv[],    // Add ".obj" extension for those who have no file extension.    for (const StringRef &path : inputPaths) -    info.appendInputFile(canonicalizeInputFileName(path)); +    info.appendInputFile(canonicalizeInputFileName(info, path));    // If -out option was not specified, the default output file name is    // constructed by replacing an extension with ".exe".    if (info.outputPath().empty() && !inputPaths.empty()) -    info.setOutputPath(getDefaultOutputFileName(inputPaths[0])); +    info.setOutputPath(getDefaultOutputFileName(info, inputPaths[0]));    // Validate the combination of options used.    return info.validate(diagnostics); | 

