summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/Support/SourceMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/Support/SourceMgr.cpp')
-rw-r--r--contrib/llvm/lib/Support/SourceMgr.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/contrib/llvm/lib/Support/SourceMgr.cpp b/contrib/llvm/lib/Support/SourceMgr.cpp
index 003cb56..b50a66b 100644
--- a/contrib/llvm/lib/Support/SourceMgr.cpp
+++ b/contrib/llvm/lib/Support/SourceMgr.cpp
@@ -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,
@@ -54,20 +49,20 @@ unsigned SourceMgr::AddIncludeFile(const std::string &Filename,
std::string &IncludedFile) {
IncludedFile = Filename;
ErrorOr<std::unique_ptr<MemoryBuffer>> NewBufOrErr =
- MemoryBuffer::getFile(IncludedFile.c_str());
+ MemoryBuffer::getFile(IncludedFile);
// If the file didn't exist directly, see if it's in an include path.
for (unsigned i = 0, e = IncludeDirectories.size(); i != e && !NewBufOrErr;
++i) {
IncludedFile =
IncludeDirectories[i] + sys::path::get_separator().data() + Filename;
- NewBufOrErr = MemoryBuffer::getFile(IncludedFile.c_str());
+ NewBufOrErr = MemoryBuffer::getFile(IncludedFile);
}
if (!NewBufOrErr)
return 0;
- return AddNewSourceBuffer(NewBufOrErr.get().release(), IncludeLoc);
+ return AddNewSourceBuffer(std::move(*NewBufOrErr), IncludeLoc);
}
unsigned SourceMgr::FindBufferContainingLoc(SMLoc Loc) const {
OpenPOWER on IntegriCloud