Change SourceManager::getDataStructureSizes() to use llvm::capacity_in_bytes().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136236 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index 68c58f7..4f2922b 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -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);
}