mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-10 06:03:52 +00:00
[LTO] Fix a use-after-free introduced in r278907 and caught by ASan.
The ASan build bot caught this right away: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/15580/steps/check-llvm%20asan/logs/stdio This was also breaking a Windows build bot I'm pretty sure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278912 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
de2442ac75
commit
ba80e96675
@ -77,10 +77,10 @@ template <typename T> static T check(ErrorOr<T> E, std::string Msg) {
|
||||
namespace {
|
||||
// Define the LTOOutput handling
|
||||
class LTOOutput : public lto::NativeObjectOutput {
|
||||
StringRef Path;
|
||||
std::string Path;
|
||||
|
||||
public:
|
||||
LTOOutput(StringRef Path) : Path(Path) {}
|
||||
LTOOutput(std::string Path) : Path(std::move(Path)) {}
|
||||
std::unique_ptr<raw_pwrite_stream> getStream() override {
|
||||
std::error_code EC;
|
||||
auto S = llvm::make_unique<raw_fd_ostream>(Path, EC, sys::fs::F_None);
|
||||
@ -174,7 +174,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
auto AddOutput = [&](size_t Task) {
|
||||
std::string Path = OutputFilename + "." + utostr(Task);
|
||||
return llvm::make_unique<LTOOutput>(Path);
|
||||
return llvm::make_unique<LTOOutput>(std::move(Path));
|
||||
};
|
||||
|
||||
check(Lto.run(AddOutput), "LTO::run failed");
|
||||
|
Loading…
Reference in New Issue
Block a user