summaryrefslogtreecommitdiffstats
path: root/clang/include/clang-c/Index.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-04-18 22:47:10 +0000
committerTed Kremenek <kremenek@apple.com>2011-04-18 22:47:10 +0000
commit83f642e54acdbcd804653b2d998e8035d8657c88 (patch)
tree7d097cab3da9b60e93f339fcdae80cbb01b8255a /clang/include/clang-c/Index.h
parentdb571c6e444bb3a34dd32630f13bd74c78e3b589 (diff)
downloadbcm5719-llvm-83f642e54acdbcd804653b2d998e8035d8657c88.tar.gz
bcm5719-llvm-83f642e54acdbcd804653b2d998e8035d8657c88.zip
Add libclang API to query how much memory is used by a CXTranslationUnit. This is a WIP. Currently we report
the amount used for expressions, types, identifiers, and selectors. llvm-svn: 129730
Diffstat (limited to 'clang/include/clang-c/Index.h')
-rw-r--r--clang/include/clang-c/Index.h51
1 files changed, 50 insertions, 1 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 715a360c4be..11e060b27a4 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -1012,7 +1012,56 @@ CINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU,
unsigned num_unsaved_files,
struct CXUnsavedFile *unsaved_files,
unsigned options);
-
+
+/**
+ * \brief Categorizes how memory is being used by a translation unit.
+ */
+enum CXTUMemoryUsageKind {
+ CXTUMemoryUsage_AST = 1,
+ CXTUMemoryUsage_Identifiers = 2,
+ CXTUMemoryUsage_Selectors = 3,
+ CXTUMemoryUsage_First = CXTUMemoryUsage_AST,
+ CXTUMemoryUsage_Last = CXTUMemoryUsage_Selectors
+};
+
+/**
+ * \brief Returns the human-readable null-terminated C string that represents
+ * the name of the memory category.
+ */
+CINDEX_LINKAGE
+const char *clang_getTUMemoryUsageName(enum CXTUMemoryUsageKind kind);
+
+typedef struct CXTUMemoryUsageEntry {
+ /* \brief The memory usage category. */
+ enum CXTUMemoryUsageKind kind;
+ /* \brief Memory usage in bytes. */
+ unsigned long amount;
+} CXTUMemoryUsageEntry;
+
+/**
+ * \brief The memory usage of a CXTranslationUnit, broken into categories.
+ */
+typedef struct CXTUMemoryUsage {
+ /* \brief Private data member, used for queries. */
+ void *data;
+
+ /* \brief The number of entries in the 'entries' array. */
+ unsigned numEntries;
+
+ /* \brief An array of key-value pairs, representing the breakdown of memory
+ usage. */
+ CXTUMemoryUsageEntry *entries;
+
+} CXTUMemoryUsage;
+
+/**
+ * \brief Return the memory usage of a translation unit. This object
+ * should be released with clang_disposeCXTUMemoryUsage().
+ */
+CINDEX_LINKAGE CXTUMemoryUsage clang_getCXTUMemoryUsage(CXTranslationUnit TU);
+
+CINDEX_LINKAGE void clang_disposeCXTUMemoryUsage(CXTUMemoryUsage usage);
+
/**
* @}
*/
OpenPOWER on IntegriCloud