summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-04-28 23:46:20 +0000
committerTed Kremenek <kremenek@apple.com>2011-04-28 23:46:20 +0000
commit5e1ed7b8ddb72f24686265ef897c286050957612 (patch)
tree756b785ba4f470dbb2c68d1ec11566b8e091bf89 /clang/tools/libclang/CIndex.cpp
parent6d003c3041e2325ea30ff95306467ff3829addca (diff)
downloadbcm5719-llvm-5e1ed7b8ddb72f24686265ef897c286050957612.tar.gz
bcm5719-llvm-5e1ed7b8ddb72f24686265ef897c286050957612.zip
Enhance clang_getCXTUResourceUsage() to report the sizes of the memory buffers used by PCH.
llvm-svn: 130460
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 364120c61b3..1379ee19fc8 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -5232,6 +5232,12 @@ const char *clang_getTUResourceUsageName(CXTUResourceUsageKind kind) {
case CXTUResourceUsage_SourceManager_Membuffer_MMap:
str = "SourceManager: mmap'ed memory buffers";
break;
+ case CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc:
+ str = "ExternalASTSource: malloc'ed memory buffers";
+ break;
+ case CXTUResourceUsage_ExternalASTSource_Membuffer_MMap:
+ str = "ExternalASTSource: mmap'ed memory buffers";
+ break;
}
return str;
}
@@ -5284,9 +5290,22 @@ CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU) {
createCXTUResourceUsageEntry(*entries,
CXTUResourceUsage_SourceManager_Membuffer_Malloc,
(unsigned long) srcBufs.malloc_bytes);
- createCXTUResourceUsageEntry(*entries,
+ createCXTUResourceUsageEntry(*entries,
CXTUResourceUsage_SourceManager_Membuffer_MMap,
(unsigned long) srcBufs.mmap_bytes);
+
+ // How much memory is being used by the ExternalASTSource?
+ if (ExternalASTSource *esrc = astContext.getExternalSource()) {
+ const ExternalASTSource::MemoryBufferSizes &sizes =
+ esrc->getMemoryBufferSizes();
+
+ createCXTUResourceUsageEntry(*entries,
+ CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc,
+ (unsigned long) sizes.malloc_bytes);
+ createCXTUResourceUsageEntry(*entries,
+ CXTUResourceUsage_ExternalASTSource_Membuffer_MMap,
+ (unsigned long) sizes.mmap_bytes);
+ }
CXTUResourceUsage usage = { (void*) entries.get(),
(unsigned) entries->size(),
OpenPOWER on IntegriCloud