diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-04-15 21:34:12 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-04-15 21:34:12 +0000 |
commit | 64729e56dcc98a52cfce71e874f057bb6a064b19 (patch) | |
tree | d34f946ce4223a7b1a4039614ae23f319b322807 /lib/Basic/SourceManager.cpp | |
parent | 859d2b24895e5bfaa52005a48a36236024175bfb (diff) | |
download | clang-64729e56dcc98a52cfce71e874f057bb6a064b19.tar.gz |
[Allocator] Make the ContentCache object actually carry the 8-byte
alignment constraint rather than using the allocator function's over
alignment "feature". This was the only use of the "feature" which I plan
to remove next. =] Attaching the alignment to the type seems cleaner and
more principled anyways.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206324 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r-- | lib/Basic/SourceManager.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index b78e9f596e..c78c285e31 100644 --- a/lib/Basic/SourceManager.cpp +++ b/lib/Basic/SourceManager.cpp @@ -436,12 +436,8 @@ SourceManager::getOrCreateContentCache(const FileEntry *FileEnt, ContentCache *&Entry = FileInfos[FileEnt]; if (Entry) return Entry; - // Nope, create a new Cache entry. Make sure it is at least 8-byte aligned - // so that FileInfo can use the low 3 bits of the pointer for its own - // nefarious purposes. - unsigned EntryAlign = llvm::AlignOf<ContentCache>::Alignment; - EntryAlign = std::max(8U, EntryAlign); - Entry = ContentCacheAlloc.Allocate<ContentCache>(1, EntryAlign); + // Nope, create a new Cache entry. + Entry = ContentCacheAlloc.Allocate<ContentCache>(); if (OverriddenFilesInfo) { // If the file contents are overridden with contents from another file, @@ -468,12 +464,8 @@ SourceManager::getOrCreateContentCache(const FileEntry *FileEnt, /// memory buffer. This does no caching. const ContentCache* SourceManager::createMemBufferContentCache(const MemoryBuffer *Buffer) { - // Add a new ContentCache to the MemBufferInfos list and return it. Make sure - // it is at least 8-byte aligned so that FileInfo can use the low 3 bits of - // the pointer for its own nefarious purposes. - unsigned EntryAlign = llvm::AlignOf<ContentCache>::Alignment; - EntryAlign = std::max(8U, EntryAlign); - ContentCache *Entry = ContentCacheAlloc.Allocate<ContentCache>(1, EntryAlign); + // Add a new ContentCache to the MemBufferInfos list and return it. + ContentCache *Entry = ContentCacheAlloc.Allocate<ContentCache>(); new (Entry) ContentCache(); MemBufferInfos.push_back(Entry); Entry->setBuffer(Buffer); |