[cfe-commits] r144991 - /cfe/trunk/include/clang/Basic/SourceManager.h

Douglas Gregor dgregor at apple.com
Sat Nov 19 01:42:42 PST 2011


Author: dgregor
Date: Sat Nov 19 03:42:42 2011
New Revision: 144991

URL: http://llvm.org/viewvc/llvm-project?rev=144991&view=rev
Log:
Add missing initialization in the ContentCache. Seriously, when do
constructors go below public member functions?

Modified:
    cfe/trunk/include/clang/Basic/SourceManager.h

Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=144991&r1=144990&r2=144991&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Sat Nov 19 03:42:42 2011
@@ -111,6 +111,31 @@
     /// 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 @@
       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);





More information about the cfe-commits mailing list