[cfe-commits] r136236 - /cfe/trunk/lib/Basic/SourceManager.cpp

Ted Kremenek kremenek at apple.com
Wed Jul 27 11:41:16 PDT 2011


Author: kremenek
Date: Wed Jul 27 13:41:16 2011
New Revision: 136236

URL: http://llvm.org/viewvc/llvm-project?rev=136236&view=rev
Log:
Change SourceManager::getDataStructureSizes() to use llvm::capacity_in_bytes().

Modified:
    cfe/trunk/lib/Basic/SourceManager.cpp

Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=136236&r1=136235&r2=136236&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Wed Jul 27 13:41:16 2011
@@ -21,6 +21,7 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/Capacity.h"
 #include <algorithm>
 #include <string>
 #include <cstring>
@@ -1555,7 +1556,7 @@
   llvm::errs() << FileInfos.size() << " files mapped, " << MemBufferInfos.size()
                << " mem buffers mapped.\n";
   llvm::errs() << LocalSLocEntryTable.size() << " local SLocEntry's allocated ("
-               << LocalSLocEntryTable.capacity()*sizeof(SrcMgr::SLocEntry)
+               << llvm::capacity_in_bytes(LocalSLocEntryTable)
                << " bytes of capacity), "
                << NextLocalOffset << "B of Sloc address space used.\n";
   llvm::errs() << LoadedSLocEntryTable.size()
@@ -1599,10 +1600,10 @@
 }
 
 size_t SourceManager::getDataStructureSizes() const {
-  return MemBufferInfos.capacity()
-    + LocalSLocEntryTable.capacity()
-    + LoadedSLocEntryTable.capacity()
-    + SLocEntryLoaded.capacity()
-    + FileInfos.getMemorySize()
-    + OverriddenFiles.getMemorySize();
+  return llvm::capacity_in_bytes(MemBufferInfos)
+    + llvm::capacity_in_bytes(LocalSLocEntryTable)
+    + llvm::capacity_in_bytes(LoadedSLocEntryTable)
+    + llvm::capacity_in_bytes(SLocEntryLoaded)
+    + llvm::capacity_in_bytes(FileInfos)
+    + llvm::capacity_in_bytes(OverriddenFiles);
 }





More information about the cfe-commits mailing list