[Driver][Index] Add driver support to specify an overriding output path to record in the index data

The frontend supports this via new options -index-unit-output-path and
-index-unit-output-path-filelist that mirror -o and -output-filelist. These are
intended to allow sharing index data across builds in separate directories (so
different -o values) that are otherwise equivalent as far as the index data is
concerned (e.g. an ASAN build and a non-ASAN build) by supplying the same
-index-unit-output-path for both.

This change updates the driver to add these new options to the frontend
invocation 1) when a new "index-unit-output-path" entry is specified for one
or more input files in the -output-file-map json or 2) if -index-file is
specified, when a new -index-unit-output-path driver option is passed.

Resolves rdar://problem/74816412
This commit is contained in:
Nathan Hawes
2021-03-04 17:31:21 +10:00
parent 2e1fca35e0
commit 117f03b2f5
11 changed files with 334 additions and 11 deletions

View File

@@ -102,7 +102,7 @@
//
// B) Run with -index-unit-output-path values different from the -o values:
// RUN: %target-swift-frontend -typecheck -parse-stdlib -enable-batch-mode \
// RUN: -module-name mod_name -index-store-path %t/idx_with \
// RUN: -module-name mod_name -index-store-path %t/idx_batch_with \
// RUN: -primary-file %t/main.swift -primary-file %t/second.swift \
// RUN: -o %t/main_out.o -o %t/second_out.o \
// RUN: -index-unit-output-path %t/custom_main.o -index-unit-output-path %t/custom_second.o