summaryrefslogtreecommitdiffstats
path: root/tools/c-index-test
diff options
context:
space:
mode:
authorErik Verbruggen <erikjv@me.com>2017-05-30 14:25:54 +0000
committerErik Verbruggen <erikjv@me.com>2017-05-30 14:25:54 +0000
commit91321d9884b7ce357cac1d128244d22dbe2a0cc7 (patch)
treeb47a0b63a497050701d60321d40a816062d3c83c /tools/c-index-test
parentce14f2c54ac4d7ba117337bf79420cebbd489481 (diff)
[libclang] Allow to suspend a translation unit.
A suspended translation unit uses significantly less memory but on the other side does not support any other calls than clang_reparseTranslationUnit to resume it or clang_disposeTranslationUnit to dispose it completely. This helps IDEs to reduce the memory footprint. The data that is freed by a call to clang_suspendTranslationUnit will be re-generated on the next (re)parse anyway. Used with a preamble, this allows pretty fast resumption of the translation unit for further use (compared to disposal of the translation unit and a parse from scratch). Patch by Nikolai Kosjar! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/c-index-test')
-rw-r--r--tools/c-index-test/c-index-test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 1f5d604431..31ad828a2f 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -1742,6 +1742,8 @@ int perform_test_load_source(int argc, const char **argv,
return -1;
if (Repeats > 1) {
+ clang_suspendTranslationUnit(TU);
+
Err = clang_reparseTranslationUnit(TU, num_unsaved_files, unsaved_files,
clang_defaultReparseOptions(TU));
if (Err != CXError_Success) {