aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-04-28 04:10:31 +0000
committerTed Kremenek <kremenek@apple.com>2011-04-28 04:10:31 +0000
commit457aaf0692dfb2d9638f383334b81027f637f20c (patch)
tree907b0b5779a322f21885262baec83f160da359e4 /tools/libclang/CIndex.cpp
parentd7f02df6e949aaf26706bea3ac79ed65ca792a30 (diff)
Enhance clang_getCXTUResourceUsage() to report the amount of memory used by SourceManager's content cache allocator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130380 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndex.cpp')
-rw-r--r--tools/libclang/CIndex.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 673f3eb509..c72d49634b 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -5220,6 +5220,9 @@ const char *clang_getTUResourceUsageName(CXTUResourceUsageKind kind) {
case CXTUResourceUsage_GlobalCompletionResults:
str = "Code completion: cached global results";
break;
+ case CXTUResourceUsage_SourceManagerContentCache:
+ str = "SourceManager: content cache allocator";
+ break;
}
return str;
}
@@ -5252,8 +5255,14 @@ CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU) {
astUnit->getCachedCompletionAllocator().getPtr()) {
completionBytes = completionAllocator-> getTotalMemory();
}
- createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_GlobalCompletionResults,
- completionBytes);
+ createCXTUResourceUsageEntry(*entries,
+ CXTUResourceUsage_GlobalCompletionResults,
+ completionBytes);
+
+ // How much memory is being used by SourceManager's content cache?
+ createCXTUResourceUsageEntry(*entries,
+ CXTUResourceUsage_SourceManagerContentCache,
+ (unsigned long) astContext.getSourceManager().getContentCacheSize());
CXTUResourceUsage usage = { (void*) entries.get(),