summaryrefslogtreecommitdiffstats
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-12-03 01:54:28 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-12-03 01:54:28 +0000
commit11089669593e64ee6300be0d3b26204fb3c3957d (patch)
tree7fecfcb3228347ed11a578631eea63c157e97a25 /clang/tools/c-index-test/c-index-test.c
parentaba7d48764d31976279f7a077cb5b93a89e7e774 (diff)
downloadbcm5719-llvm-11089669593e64ee6300be0d3b26204fb3c3957d.tar.gz
bcm5719-llvm-11089669593e64ee6300be0d3b26204fb3c3957d.zip
Switch clang_createTranslationUnitFromSourceFile to use ASTUnit::LoadFromCommandLine.
- This is much faster, as it avoids the overhead of dumping an AST file to disk and reloading it. - For debugging purposes, there is a clang_setUseExternalASTGeneration hook which can be used to disable this. On the Sketch Cocoa app, the speedup is pretty nice, especially when using a PCH file while scanning the source: Wall time to c-index-test all files (no PCH): Old: 23.4221 New: 12.3884 Wall time to c-index-test all files (with a PCH, and "local" mode): Old: 10.9233 New: 1.9038 llvm-svn: 90385
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index efff1ae3188..7300585a1d8 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -179,12 +179,17 @@ int perform_test_load_tu(const char *file, const char *filter) {
}
int perform_test_load_source(int argc, const char **argv, const char *filter) {
+ const char *UseExternalASTs =
+ getenv("CINDEXTEST_USE_EXTERNAL_AST_GENERATION");
CXIndex Idx;
CXTranslationUnit TU;
Idx = clang_createIndex(/* excludeDeclsFromPCH */
!strcmp(filter, "local") ? 1 : 0,
/* displayDiagnostics */ 1);
+ if (UseExternalASTs && strlen(UseExternalASTs))
+ clang_setUseExternalASTGeneration(Idx, 1);
+
TU = clang_createTranslationUnitFromSourceFile(Idx, 0, argc, argv);
if (!TU) {
fprintf(stderr, "Unable to load translation unit!\n");
OpenPOWER on IntegriCloud