Skip to content

Commit 6eaa433

Browse files
authored
Merge pull request #1418 from ahoppen/dont-index-fallback-args
Don’t index files with fallback build settings
2 parents 922d94b + 1553c9c commit 6eaa433

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,17 @@ public struct UpdateIndexStoreTaskDescription: IndexTaskDescription {
226226
logger.error("Not indexing \(file.forLogging) because it has no compiler arguments")
227227
return
228228
}
229+
if buildSettings.isFallback {
230+
// Fallback build settings don’t even have an indexstore path set, so they can't generate index data that we would
231+
// pick up. Also, indexing with fallback args has some other problems:
232+
// - If it did generate a unit file, we would consider the file’s index up-to-date even if the compiler arguments
233+
// change, which means that we wouldn't get any up-to-date-index even when we have build settings for the file.
234+
// - It's unlikely that the index from a single file with fallback arguments will be very useful as it can't tie
235+
// into the rest of the project.
236+
// So, don't index the file.
237+
logger.error("Not indexing \(file.forLogging) because it has fallback compiler arguments")
238+
return
239+
}
229240
guard let toolchain = await buildSystemManager.toolchain(for: file.mainFile, language) else {
230241
logger.error(
231242
"Not updating index store for \(file.forLogging) because no toolchain could be determined for the document"

0 commit comments

Comments
 (0)