diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-10-30 22:57:35 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-10-30 22:57:35 +0000 |
commit | 0d892d8bfddd4916cc4f3467e1184a623d0716da (patch) | |
tree | fe1592f2324642af2e6cba1f48b5f7067d50f4a2 /Basic/SourceManager.cpp | |
parent | 7da36f642e907ff5a5ba4b18b5bfebfabf36ecc7 (diff) |
Updated some comments.
Disabled assignments for ContentCache.
Copy-ctor for ContentCache now has an assertion preventing it to
be copied from an object that already has an allocated buffer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43526 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic/SourceManager.cpp')
-rw-r--r-- | Basic/SourceManager.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Basic/SourceManager.cpp b/Basic/SourceManager.cpp index 59103caf29..5c960a7d15 100644 --- a/Basic/SourceManager.cpp +++ b/Basic/SourceManager.cpp @@ -116,11 +116,14 @@ const ContentCache* SourceManager::getContentCache(const FileEntry *FileEnt) { } -/// createMemBufferInfoRec - Create a new info record for the specified memory +/// createMemBufferInfoRec - Create a new ContentCache for the specified memory /// buffer. This does no caching. const ContentCache* SourceManager::createMemBufferContentCache(const MemoryBuffer *Buffer) { - // Add a new info record to the MemBufferInfos list and return it. + // Add a new ContentCache to the MemBufferInfos list and return it. We + // must default construct the object first that the instance actually + // stored within MemBufferInfos actually owns the Buffer, and not any + // temporary we would use in the call to "push_back". MemBufferInfos.push_back(ContentCache()); ContentCache& Entry = const_cast<ContentCache&>(MemBufferInfos.back()); Entry.Buffer = Buffer; @@ -128,9 +131,9 @@ SourceManager::createMemBufferContentCache(const MemoryBuffer *Buffer) { } -/// createFileID - Create a new fileID for the specified InfoRec and include -/// position. This works regardless of whether the InfoRec corresponds to a -/// file or some other input source. +/// createFileID - Create a new fileID for the specified ContentCache and +/// include position. This works regardless of whether the ContentCache +/// corresponds to a file or some other input source. unsigned SourceManager::createFileID(const ContentCache *File, SourceLocation IncludePos) { // If FileEnt is really large (e.g. it's a large .i file), we may not be able |