diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-11-19 09:42:42 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-11-19 09:42:42 +0000 |
commit | 7955a25c65b3c3213a5e9375f51a02a765a3c880 (patch) | |
tree | fc9791f756d330603d23f75b1c65eb5641dda257 /include/clang/Basic/SourceManager.h | |
parent | 9d38dbc9a16017fff3e34b7876a6590413a7d56b (diff) |
Add missing initialization in the ContentCache. Seriously, when do
constructors go below public member functions?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144991 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
-rw-r--r-- | include/clang/Basic/SourceManager.h | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index cfd0430e60..b1a9c6bb4e 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -111,6 +111,31 @@ namespace SrcMgr { /// exist. unsigned BufferOverridden : 1; + ContentCache(const FileEntry *Ent = 0) + : Buffer(0, false), OrigEntry(Ent), ContentsEntry(Ent), + SourceLineCache(0), NumLines(0), BufferOverridden(false) {} + + ContentCache(const FileEntry *Ent, const FileEntry *contentEnt) + : Buffer(0, false), OrigEntry(Ent), ContentsEntry(contentEnt), + SourceLineCache(0), NumLines(0), BufferOverridden(false) {} + + ~ContentCache(); + + /// The copy ctor does not allow copies where source object has either + /// a non-NULL Buffer or SourceLineCache. Ownership of allocated memory + /// is not transferred, so this is a logical error. + ContentCache(const ContentCache &RHS) + : Buffer(0, false), SourceLineCache(0), BufferOverridden(false) + { + OrigEntry = RHS.OrigEntry; + ContentsEntry = RHS.ContentsEntry; + + assert (RHS.Buffer.getPointer() == 0 && RHS.SourceLineCache == 0 && + "Passed ContentCache object cannot own a buffer."); + + NumLines = RHS.NumLines; + } + /// getBuffer - Returns the memory buffer for the associated content. /// /// \param Diag Object through which diagnostics will be emitted if the @@ -166,31 +191,6 @@ namespace SrcMgr { return (Buffer.getInt() & DoNotFreeFlag) == 0; } - ContentCache(const FileEntry *Ent = 0) - : Buffer(0, false), OrigEntry(Ent), ContentsEntry(Ent), - SourceLineCache(0), NumLines(0) {} - - ContentCache(const FileEntry *Ent, const FileEntry *contentEnt) - : Buffer(0, false), OrigEntry(Ent), ContentsEntry(contentEnt), - SourceLineCache(0), NumLines(0) {} - - ~ContentCache(); - - /// The copy ctor does not allow copies where source object has either - /// a non-NULL Buffer or SourceLineCache. Ownership of allocated memory - /// is not transferred, so this is a logical error. - ContentCache(const ContentCache &RHS) - : Buffer(0, false), SourceLineCache(0) - { - OrigEntry = RHS.OrigEntry; - ContentsEntry = RHS.ContentsEntry; - - assert (RHS.Buffer.getPointer() == 0 && RHS.SourceLineCache == 0 && - "Passed ContentCache object cannot own a buffer."); - - NumLines = RHS.NumLines; - } - private: // Disable assignments. ContentCache &operator=(const ContentCache& RHS); |