aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-04-15 21:34:12 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-04-15 21:34:12 +0000
commit47c480875b4e6005cfc2a426b6e511f46c3411f9 (patch)
tree01950741fcdd9780228c8283ca83fee238a93a99 /clang/lib/Basic/SourceManager.cpp
parent3d90f99d1aae58b1d0ab28a0d7a838305eab2a49 (diff)
downloadllvm-47c480875b4e6005cfc2a426b6e511f46c3411f9.zip
llvm-47c480875b4e6005cfc2a426b6e511f46c3411f9.tar.gz
llvm-47c480875b4e6005cfc2a426b6e511f46c3411f9.tar.bz2
[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. llvm-svn: 206324
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index b78e9f59..c78c285 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/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);