clang_getCXTUResourceUsage: report memory used by HeaderSearch.
This required converting the StringMaps to use a BumpPtrAllocator. I measured the
compile time and saw no observable regression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136190 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp
index e2fd029..789c93f 100644
--- a/lib/Lex/HeaderSearch.cpp
+++ b/lib/Lex/HeaderSearch.cpp
@@ -542,4 +542,10 @@
return true;
}
-
+size_t HeaderSearch::getTotalMemory() const {
+ return SearchDirs.capacity()
+ + FileInfo.capacity()
+ + HeaderMaps.capacity()
+ + LookupFileCache.getAllocator().getTotalMemory()
+ + FrameworkMap.getAllocator().getTotalMemory();
+}