Using non absolute paths in ivfsoverlay as swiftc argument breaks autocomplete

Originator:robbert
Number:rdar://36072590 Date Originated:
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:DUPLICATE OF 21588771 Reproducible:Always
 
Summary:
When using an ivfsoverlay to point swift to a modulemap file that describes an objective-c module, if the path to the ivfsoverlay is not absolute this breaks autocomplete in Xcode.

Steps to Reproduce:
- Create a swift app and a static library dependency with an objective-c class
- Create a modulemap file to describe the dependency, name it dep.modulemap
- Create an ivfsoverlay to expose the modulemap to swift
- Add HEADER_SEARCH_PATHS to the dep headers
- Add swiftc arguments `-Xcc -ivfsoverlay -Xcc dep/module.yaml` to the main swift target
- Add a target dependency in project settings.
- In the main swift target, add an import statement the dependency. 
- Start typing some symbol from the dependency. 
- Hit cmd + space or esc for autocomplete.
===========
- Autocomplete does not work
===========
- write correct code without autocomplete
- build the project successfully

See the attached Xcode project. You'll need to fix the absolute paths present in the module.yaml file before it will build.


Expected Results:
Xcode autocompletes.

Actual Results:
Autocomplete does not work.

Version/Build:
Xcode 9.2.0 (9C40b)

Configuration:
I found a workaround in changing using an absolute path for the ivfsoverlay:

OTHER_SWIFT_FLAGS = $(inherited) -Xcc -ivfsoverlay -Xcc dep/module.yaml

to 

OTHER_SWIFT_FLAGS = $(inherited) -Xcc -ivfsoverlay -Xcc $(PROJECT_DIR)/dep/module.yaml

This is odd as one of the arguments passed to swiftc is 
```
-Xcc
-working-directory/Users/robbertvanginkel/Desktop/IndexingError
```
It seems like swift/clang when indexing doesn't respect the `-working-directory` argument when looking for the ivfsoverlay. It does seem to do it for other arguments such as the header search paths.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!