Clang: Don't parse system headers

Change-Id: I6474fbe4f43daaac930ad6ba49fd9cb3145a3bbd
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-08-14 11:46:16 +02:00
parent 4195fce68f
commit b592339b4d
4 changed files with 16 additions and 9 deletions

View File

@@ -74,8 +74,8 @@ private:
{
clang::index::IndexingOptions options;
options.SystemSymbolFilter = clang::index::IndexingOptions::SystemSymbolFilterKind::All;
options.IndexFunctionLocals = true;
options.SystemSymbolFilter = clang::index::IndexingOptions::SystemSymbolFilterKind::None;
options.IndexFunctionLocals = false;
return options;
}

View File

@@ -34,3 +34,8 @@ void f()
void f(int);
void f(double);
void f2()
{
function();
}

View File

@@ -97,11 +97,12 @@ TEST_F(SymbolIndexing, Locations)
{
indexing.indexer().updateProjectParts({projectPart1}, {});
auto locations = query.locationsAt(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 6, 5);
auto locations = query.locationsAt(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 1, 6);
ASSERT_THAT(locations,
ElementsAre(
IsLocation(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 5, 9),
IsLocation(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 6, 5)));
IsLocation(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 1, 6),
IsLocation(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 3, 6),
IsLocation(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 40, 5)));
}
TEST_F(SymbolIndexing, DISABLED_TemplateFunction)
@@ -121,11 +122,12 @@ TEST_F(SymbolIndexing, PathsAreUpdated)
indexing.indexer().pathsChanged({filePathId(main1Path)});
indexing.indexer().pathsChanged({filePathId(main1Path)});
auto locations = query.locationsAt(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 6, 5);
auto locations = query.locationsAt(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 1, 6);
ASSERT_THAT(locations,
ElementsAre(
IsLocation(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 5, 9),
IsLocation(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 6, 5)));
IsLocation(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 1, 6),
IsLocation(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 3, 6),
IsLocation(filePathId(TESTDATA_DIR "/symbolindexing_main1.cpp"), 40, 5)));
}
}

View File

@@ -168,7 +168,7 @@ TEST_F(SymbolsCollector, CollectSymbolName)
collector.collectSymbols();
ASSERT_THAT(collector.symbols(),
Contains(HasSymbolName("x")));
Contains(HasSymbolName("function")));
}
TEST_F(SymbolsCollector, SymbolMatchesLocation)