diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-04-02 12:25:07 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-04-02 12:25:07 +0000 |
commit | 62c6c7cf3abbdb1121cc63c6247ab67ade756444 (patch) | |
tree | fc64f6ba77ef9a27a97e8d981bb2c21c77e390f1 /include/clang/Basic/SourceManager.h | |
parent | ec2dad61481ab20c2a579bf0edec8223aa56f9dc (diff) |
Replace custom alignment enforcement with LLVM_ALIGNAS.
This isn't perfect as it still assumes sizeof(void*) == alignof(void*),
but we can fix that when compiler support gets better.
Shrinks some Stmts that happen to inherit from Stmt and have a
SourceLocation as the first member (64 bit archs only).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233911 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
-rw-r--r-- | include/clang/Basic/SourceManager.h | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 4fa95c59a1..3aea5ea982 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -82,7 +82,7 @@ namespace SrcMgr { /// \brief One instance of this struct is kept for every file loaded or used. /// /// This object owns the MemoryBuffer object. - class ContentCache { + class LLVM_ALIGNAS(8) ContentCache { enum CCFlags { /// \brief Whether the buffer is invalid. InvalidFlag = 0x01, @@ -90,15 +90,6 @@ namespace SrcMgr { DoNotFreeFlag = 0x02 }; - // Note that the first member of this class is an aligned character buffer - // to ensure that this class has an alignment of 8 bytes. This wastes - // 8 bytes for every ContentCache object, but each of these corresponds to - // a file loaded into memory, so the 8 bytes doesn't seem terribly - // important. It is quite awkward to fit this aligner into any other part - // of the class due to the lack of portable ways to combine it with other - // members. - llvm::AlignedCharArray<8, 1> NonceAligner; - /// \brief The actual buffer containing the characters from the input /// file. /// @@ -142,14 +133,9 @@ namespace SrcMgr { /// \brief True if this content cache was initially created for a source /// file considered as a system one. unsigned IsSystemFile : 1; - - ContentCache(const FileEntry *Ent = nullptr) - : Buffer(nullptr, false), OrigEntry(Ent), ContentsEntry(Ent), - SourceLineCache(nullptr), NumLines(0), BufferOverridden(false), - IsSystemFile(false) { - (void)NonceAligner; // Silence warnings about unused member. - } - + + ContentCache(const FileEntry *Ent = nullptr) : ContentCache(Ent, Ent) {} + ContentCache(const FileEntry *Ent, const FileEntry *contentEnt) : Buffer(nullptr, false), OrigEntry(Ent), ContentsEntry(contentEnt), SourceLineCache(nullptr), NumLines(0), BufferOverridden(false), |