[Frontend][Index] Add frontend option to skip indexing the stdlib (for test performance)

Several tests related to indexing system modules were taking a considerable
amount of time (100+ seconds in the worst case) indexing the standard library.
This adds a frontend option to skip it and updates those tests to pass it.
This commit is contained in:
Nathan Hawes
2020-03-25 14:36:23 -07:00
parent 8b03b05f1d
commit a785fa6cee
9 changed files with 52 additions and 15 deletions

View File

@@ -36,6 +36,9 @@ namespace index {
/// \param indexSystemModules If true, emit index data for imported serialized
/// swift system modules.
///
/// \param skipStdlib If indexing system modules, don't index the standard
/// library.
///
/// \param isDebugCompilation true for non-optimized compiler invocation.
///
/// \param targetTriple The target for this compilation.
@@ -43,7 +46,8 @@ namespace index {
/// \param dependencyTracker The set of dependencies seen while building.
bool indexAndRecord(SourceFile *primarySourceFile, StringRef indexUnitToken,
StringRef indexStorePath, bool indexSystemModules,
bool isDebugCompilation, StringRef targetTriple,
bool skipStdlib, bool isDebugCompilation,
StringRef targetTriple,
const DependencyTracker &dependencyTracker);
/// Index the given module and store the results to \p indexStorePath.
@@ -64,6 +68,9 @@ bool indexAndRecord(SourceFile *primarySourceFile, StringRef indexUnitToken,
/// \param indexSystemModules If true, emit index data for imported serialized
/// swift system modules.
///
/// \param skipStdlib If indexing system modules, don't index the standard
/// library.
///
/// \param isDebugCompilation true for non-optimized compiler invocation.
///
/// \param targetTriple The target for this compilation.
@@ -71,8 +78,8 @@ bool indexAndRecord(SourceFile *primarySourceFile, StringRef indexUnitToken,
/// \param dependencyTracker The set of dependencies seen while building.
bool indexAndRecord(ModuleDecl *module, ArrayRef<std::string> indexUnitTokens,
StringRef moduleUnitToken, StringRef indexStorePath,
bool indexSystemModules, bool isDebugCompilation,
StringRef targetTriple,
bool indexSystemModules, bool skipStdlib,
bool isDebugCompilation, StringRef targetTriple,
const DependencyTracker &dependencyTracker);
// FIXME: indexUnitTokens could be StringRef, but that creates an impedance
// mismatch in the caller.