forked from OSchip/llvm-project
Fix two test-only leaks found by LSan.
The result of getBufferForFile() must be freed. (Should we change functions that expect the caller to assume ownership so that they return unique_ptrs instead? Then the type system makes sure we get this right.) llvm-svn: 207074
This commit is contained in:
parent
82098cb6df
commit
4fcf0c7b29
|
@ -252,7 +252,9 @@ public:
|
||||||
// descriptor, which might not see the changes made.
|
// descriptor, which might not see the changes made.
|
||||||
// FIXME: Figure out whether there is a way to get the SourceManger to
|
// FIXME: Figure out whether there is a way to get the SourceManger to
|
||||||
// reopen the file.
|
// reopen the file.
|
||||||
return Context.Files.getBufferForFile(Path, NULL)->getBuffer();
|
std::unique_ptr<const llvm::MemoryBuffer> FileBuffer(
|
||||||
|
Context.Files.getBufferForFile(Path, NULL));
|
||||||
|
return FileBuffer->getBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::StringMap<std::string> TemporaryFiles;
|
llvm::StringMap<std::string> TemporaryFiles;
|
||||||
|
|
|
@ -102,7 +102,9 @@ class RewriterTestContext {
|
||||||
// descriptor, which might not see the changes made.
|
// descriptor, which might not see the changes made.
|
||||||
// FIXME: Figure out whether there is a way to get the SourceManger to
|
// FIXME: Figure out whether there is a way to get the SourceManger to
|
||||||
// reopen the file.
|
// reopen the file.
|
||||||
return Files.getBufferForFile(Path, NULL)->getBuffer();
|
std::unique_ptr<const llvm::MemoryBuffer> FileBuffer(
|
||||||
|
Files.getBufferForFile(Path, NULL));
|
||||||
|
return FileBuffer->getBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
|
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
|
||||||
|
|
Loading…
Reference in New Issue