mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-24 13:18:17 +00:00
Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216223 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -42,11 +42,6 @@ SourceMgr::~SourceMgr() {
|
||||
// Delete the line # cache if allocated.
|
||||
if (LineNoCacheTy *Cache = getCache(LineNoCache))
|
||||
delete Cache;
|
||||
|
||||
while (!Buffers.empty()) {
|
||||
delete Buffers.back().Buffer;
|
||||
Buffers.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned SourceMgr::AddIncludeFile(const std::string &Filename,
|
||||
@@ -67,7 +62,7 @@ unsigned SourceMgr::AddIncludeFile(const std::string &Filename,
|
||||
if (!NewBufOrErr)
|
||||
return 0;
|
||||
|
||||
return AddNewSourceBuffer(NewBufOrErr.get().release(), IncludeLoc);
|
||||
return AddNewSourceBuffer(std::move(*NewBufOrErr), IncludeLoc);
|
||||
}
|
||||
|
||||
unsigned SourceMgr::FindBufferContainingLoc(SMLoc Loc) const {
|
||||
|
||||
Reference in New Issue
Block a user