[cfe-commits] r129857 - in /cfe/trunk: include/clang-c/Index.h tools/c-index-test/c-index-test.c tools/libclang/CIndex.cpp tools/libclang/libclang.darwin.exports tools/libclang/libclang.exports
Ted Kremenek
kremenek at apple.com
Wed Apr 20 09:41:08 PDT 2011
Author: kremenek
Date: Wed Apr 20 11:41:07 2011
New Revision: 129857
URL: http://llvm.org/viewvc/llvm-project?rev=129857&view=rev
Log:
Rename 'CXTUMemoryUsage…' to 'CXTUResourceUsage…'.
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/tools/c-index-test/c-index-test.c
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/libclang.darwin.exports
cfe/trunk/tools/libclang/libclang.exports
Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=129857&r1=129856&r2=129857&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Wed Apr 20 11:41:07 2011
@@ -1016,33 +1016,39 @@
/**
* \brief Categorizes how memory is being used by a translation unit.
*/
-enum CXTUMemoryUsageKind {
- CXTUMemoryUsage_AST = 1,
- CXTUMemoryUsage_Identifiers = 2,
- CXTUMemoryUsage_Selectors = 3,
- CXTUMemoryUsage_GlobalCompletionResults = 4,
- CXTUMemoryUsage_First = CXTUMemoryUsage_AST,
- CXTUMemoryUsage_Last = CXTUMemoryUsage_GlobalCompletionResults
+enum CXTUResourceUsageKind {
+ CXTUResourceUsage_AST = 1,
+ CXTUResourceUsage_Identifiers = 2,
+ CXTUResourceUsage_Selectors = 3,
+ CXTUResourceUsage_GlobalCompletionResults = 4,
+
+ CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST,
+ CXTUResourceUsage_MEMORY_IN_BYTES_END =
+ CXTUResourceUsage_GlobalCompletionResults,
+
+ CXTUResourceUsage_First = CXTUResourceUsage_AST,
+ CXTUResourceUsage_Last = CXTUResourceUsage_GlobalCompletionResults
};
/**
* \brief Returns the human-readable null-terminated C string that represents
- * the name of the memory category.
+ * the name of the memory category. This string should never be freed.
*/
CINDEX_LINKAGE
-const char *clang_getTUMemoryUsageName(enum CXTUMemoryUsageKind kind);
+const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind);
-typedef struct CXTUMemoryUsageEntry {
+typedef struct CXTUResourceUsageEntry {
/* \brief The memory usage category. */
- enum CXTUMemoryUsageKind kind;
- /* \brief Memory usage in bytes. */
+ enum CXTUResourceUsageKind kind;
+ /* \brief Amount of resources used.
+ The units will depend on the resource kind. */
unsigned long amount;
-} CXTUMemoryUsageEntry;
+} CXTUResourceUsageEntry;
/**
* \brief The memory usage of a CXTranslationUnit, broken into categories.
*/
-typedef struct CXTUMemoryUsage {
+typedef struct CXTUResourceUsage {
/* \brief Private data member, used for queries. */
void *data;
@@ -1051,17 +1057,17 @@
/* \brief An array of key-value pairs, representing the breakdown of memory
usage. */
- CXTUMemoryUsageEntry *entries;
+ CXTUResourceUsageEntry *entries;
-} CXTUMemoryUsage;
+} CXTUResourceUsage;
/**
* \brief Return the memory usage of a translation unit. This object
- * should be released with clang_disposeCXTUMemoryUsage().
+ * should be released with clang_disposeCXTUResourceUsage().
*/
-CINDEX_LINKAGE CXTUMemoryUsage clang_getCXTUMemoryUsage(CXTranslationUnit TU);
+CINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU);
-CINDEX_LINKAGE void clang_disposeCXTUMemoryUsage(CXTUMemoryUsage usage);
+CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);
/**
* @}
Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=129857&r1=129856&r2=129857&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Wed Apr 20 11:41:07 2011
@@ -373,10 +373,10 @@
void PrintMemoryUsage(CXTranslationUnit TU) {
unsigned long total = 0.0;
unsigned i = 0;
- CXTUMemoryUsage usage = clang_getCXTUMemoryUsage(TU);
+ CXTUResourceUsage usage = clang_getCXTUResourceUsage(TU);
fprintf(stderr, "Memory usage:\n");
for (i = 0 ; i != usage.numEntries; ++i) {
- const char *name = clang_getTUMemoryUsageName(usage.entries[i].kind);
+ const char *name = clang_getTUResourceUsageName(usage.entries[i].kind);
unsigned long amount = usage.entries[i].amount;
total += amount;
fprintf(stderr, " %s : %ld bytes (%f MBytes)\n", name, amount,
@@ -384,7 +384,7 @@
}
fprintf(stderr, " TOTAL = %ld bytes (%f MBytes)\n", total,
((double) total)/(1024*1024));
- clang_disposeCXTUMemoryUsage(usage);
+ clang_disposeCXTUResourceUsage(usage);
}
/******************************************************************************/
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=129857&r1=129856&r2=129857&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed Apr 20 11:41:07 2011
@@ -5181,39 +5181,39 @@
// Inspecting memory usage.
//===----------------------------------------------------------------------===//
-typedef std::vector<CXTUMemoryUsageEntry> MemUsageEntries;
+typedef std::vector<CXTUResourceUsageEntry> MemUsageEntries;
-static inline void createCXTUMemoryUsageEntry(MemUsageEntries &entries,
- enum CXTUMemoryUsageKind k,
+static inline void createCXTUResourceUsageEntry(MemUsageEntries &entries,
+ enum CXTUResourceUsageKind k,
double amount) {
- CXTUMemoryUsageEntry entry = { k, amount };
+ CXTUResourceUsageEntry entry = { k, amount };
entries.push_back(entry);
}
extern "C" {
-const char *clang_getTUMemoryUsageName(CXTUMemoryUsageKind kind) {
+const char *clang_getTUResourceUsageName(CXTUResourceUsageKind kind) {
const char *str = "";
switch (kind) {
- case CXTUMemoryUsage_AST:
+ case CXTUResourceUsage_AST:
str = "ASTContext: expressions, declarations, and types";
break;
- case CXTUMemoryUsage_Identifiers:
+ case CXTUResourceUsage_Identifiers:
str = "ASTContext: identifiers";
break;
- case CXTUMemoryUsage_Selectors:
+ case CXTUResourceUsage_Selectors:
str = "ASTContext: selectors";
break;
- case CXTUMemoryUsage_GlobalCompletionResults:
+ case CXTUResourceUsage_GlobalCompletionResults:
str = "Code completion: cached global results";
break;
}
return str;
}
-CXTUMemoryUsage clang_getCXTUMemoryUsage(CXTranslationUnit TU) {
+CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU) {
if (!TU) {
- CXTUMemoryUsage usage = { (void*) 0, 0, 0 };
+ CXTUResourceUsage usage = { (void*) 0, 0, 0 };
return usage;
}
@@ -5222,15 +5222,15 @@
ASTContext &astContext = astUnit->getASTContext();
// How much memory is used by AST nodes and types?
- createCXTUMemoryUsageEntry(*entries, CXTUMemoryUsage_AST,
+ createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_AST,
(unsigned long) astContext.getTotalAllocatedMemory());
// How much memory is used by identifiers?
- createCXTUMemoryUsageEntry(*entries, CXTUMemoryUsage_Identifiers,
+ createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_Identifiers,
(unsigned long) astContext.Idents.getAllocator().getTotalMemory());
// How much memory is used for selectors?
- createCXTUMemoryUsageEntry(*entries, CXTUMemoryUsage_Selectors,
+ createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_Selectors,
(unsigned long) astContext.Selectors.getTotalMemory());
// How much memory is used for caching global code completion results?
@@ -5239,18 +5239,18 @@
astUnit->getCachedCompletionAllocator().getPtr()) {
completionBytes = completionAllocator-> getTotalMemory();
}
- createCXTUMemoryUsageEntry(*entries, CXTUMemoryUsage_GlobalCompletionResults,
+ createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_GlobalCompletionResults,
completionBytes);
- CXTUMemoryUsage usage = { (void*) entries.get(),
+ CXTUResourceUsage usage = { (void*) entries.get(),
(unsigned) entries->size(),
entries->size() ? &(*entries)[0] : 0 };
entries.take();
return usage;
}
-void clang_disposeCXTUMemoryUsage(CXTUMemoryUsage usage) {
+void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage) {
if (usage.data)
delete (MemUsageEntries*) usage.data;
}
Modified: cfe/trunk/tools/libclang/libclang.darwin.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.darwin.exports?rev=129857&r1=129856&r2=129857&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/libclang.darwin.exports (original)
+++ cfe/trunk/tools/libclang/libclang.darwin.exports Wed Apr 20 11:41:07 2011
@@ -21,7 +21,7 @@
_clang_defaultReparseOptions
_clang_defaultSaveOptions
_clang_disposeCXCursorSet
-_clang_disposeCXTUMemoryUsage
+_clang_disposeCXTUResourceUsage
_clang_disposeCodeCompleteResults
_clang_disposeDiagnostic
_clang_disposeIndex
@@ -36,7 +36,7 @@
_clang_executeOnThread
_clang_formatDiagnostic
_clang_getCString
-_clang_getCXTUMemoryUsage
+_clang_getCXTUResourceUsage
_clang_getCXXAccessSpecifier
_clang_getCanonicalCursor
_clang_getCanonicalType
@@ -100,7 +100,7 @@
_clang_getResultType
_clang_getSpecializedCursorTemplate
_clang_getSpellingLocation
-_clang_getTUMemoryUsageName
+_clang_getTUResourceUsageName
_clang_getTemplateCursorKind
_clang_getTokenExtent
_clang_getTokenKind
Modified: cfe/trunk/tools/libclang/libclang.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.exports?rev=129857&r1=129856&r2=129857&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/libclang.exports (original)
+++ cfe/trunk/tools/libclang/libclang.exports Wed Apr 20 11:41:07 2011
@@ -21,7 +21,7 @@
clang_defaultReparseOptions
clang_defaultSaveOptions
clang_disposeCXCursorSet
-clang_disposeCXTUMemoryUsage
+clang_disposeCXTUResourceUsage
clang_disposeCodeCompleteResults
clang_disposeDiagnostic
clang_disposeIndex
@@ -36,7 +36,7 @@
clang_executeOnThread
clang_formatDiagnostic
clang_getCString
-clang_getCXTUMemoryUsage
+clang_getCXTUResourceUsage
clang_getCXXAccessSpecifier
clang_getCanonicalCursor
clang_getCanonicalType
@@ -100,7 +100,7 @@
clang_getResultType
clang_getSpecializedCursorTemplate
clang_getSpellingLocation
-clang_getTUMemoryUsageName
+clang_getTUResourceUsageName
clang_getTemplateCursorKind
clang_getTokenExtent
clang_getTokenKind
More information about the cfe-commits
mailing list