diff options
author | Erik Verbruggen <erikjv@me.com> | 2016-01-06 15:12:51 +0000 |
---|---|---|
committer | Erik Verbruggen <erikjv@me.com> | 2016-01-06 15:12:51 +0000 |
commit | 8f9d180f0925fd8bb11cabe8bed91c98592d11e4 (patch) | |
tree | fcd1c1f7723c752b5789ccaa53e14f8ea3403c1e /clang/tools/c-index-test/c-index-test.c | |
parent | 09afa9061ae1a5937ffe258de811e6cafd86ff16 (diff) | |
download | llvm-8f9d180f0925fd8bb11cabe8bed91c98592d11e4.zip llvm-8f9d180f0925fd8bb11cabe8bed91c98592d11e4.tar.gz llvm-8f9d180f0925fd8bb11cabe8bed91c98592d11e4.tar.bz2 |
Show inclusions from a preamble in clang_getInclusions.
When reparsing a translation unit with preamble generation turned on,
no includes are found. This is due to the fact that all SLocs from
AST/PCH files are skipped as they are 'loaded', and inclusions from a
preamble are also 'loaded'. So, in case a file has a preamble, it first
needs to process those loaded inclusions, and then check for any local
inclusions. This latter one is for any includes that are not part of the
preamble, like includes half-way through a file.
This fixes PR24748.
Differential Revision: http://reviews.llvm.org/D14329
llvm-svn: 256939
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 21 |
1 files changed, 21 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 48f22eb..8336491 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -1593,6 +1593,8 @@ int perform_test_load_source(int argc, const char **argv, int num_unsaved_files = 0; enum CXErrorCode Err; int result; + unsigned Repeats = 0; + unsigned I; Idx = clang_createIndex(/* excludeDeclsFromPCH */ (!strcmp(filter, "local") || @@ -1609,6 +1611,9 @@ int perform_test_load_source(int argc, const char **argv, return -1; } + if (getenv("CINDEXTEST_EDITING")) + Repeats = 5; + Err = clang_parseTranslationUnit2(Idx, 0, argv + num_unsaved_files, argc - num_unsaved_files, @@ -1622,6 +1627,22 @@ int perform_test_load_source(int argc, const char **argv, return 1; } + for (I = 0; I != Repeats; ++I) { + if (checkForErrors(TU) != 0) + return -1; + + if (Repeats > 1) { + Err = clang_reparseTranslationUnit(TU, num_unsaved_files, unsaved_files, + clang_defaultReparseOptions(TU)); + if (Err != CXError_Success) { + describeLibclangFailure(Err); + free_remapped_files(unsaved_files, num_unsaved_files); + clang_disposeIndex(Idx); + return 1; + } + } + } + result = perform_test_load(Idx, TU, filter, NULL, Visitor, PV, CommentSchemaFile); free_remapped_files(unsaved_files, num_unsaved_files); |