-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Support mapping path prefixes for index stores #21893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support mapping path prefixes for index stores #21893
Conversation
Do you understand how/if the same problem is solved in Clang? I think the generally idea behind it sounds perfectly reasonable. It's odd for a debugging option to affect how the index is being built, but like the debugger an IDE is source-based tooling and can run into the similar problems... Would there ever be a reason to want remapped paths in the debug info bot not in the index? |
I think clang needs to be updated too, hopefully to match what's done here. I can propose this additional behavior to
Right, what we want is an option that affects development outputs, which includes debug info, index store, any any other artifacts used by development tools. Personally I'm fine with "debug" meaning "development", but I wouldn't be surprised if others aren't. In which case is the right choice to deprecate
Maybe. If you had a post build job/action that used the index, that tooling might want the paths as they exist at build time. This is speculative, I don't know of any build tools that operate post build. Having replied, I'm liking the idea of an |
I'm very much in favour of having a way to create reproducible index data. Are you also planning to add a way for
I'd be interested in @jrose-apple 's thoughts on the driver argument names. Personally, I would have preferred us not to put
I would flip this around: swift uses libIndex from clang to implement the low-level details of writing the index data, so I would plan to do both concurrently. I don't know if you need to add anything to upstream (llvm.org) clang for this at the moment since we haven't yet pushed the index data store code upstream (there is index code upstream, but not the record reader/writer stuff). It may be we only need to change swift-clang for now? |
I think I'm with Ben on that. We can't remove driver options, but we can pick more appropriate names and use those going forward. I'll stay out of the rest of the discussion, about whether this is the right way to go about this at all. |
🇨🇦
The plan is to map directly to a known path, since we'll have to do this anyway for debug info. Not yet sure of the specifics, but we'll have to figure something out. Until support for this makes it into an official Swift release, we may have to rewrite unit files to correct their paths.
Would be nice.
Sounds good, I'll open a PR for swift-clang soon From Jordan:
+1 for |
Interesting. I thought with debug info you would normally rely on the debugger being able to remap the path again (e.g. gdb searches |
I've seen it done this way, but for lldb it requires local lldb config be correct. We are currently using lldb's @allevato are you planning to remap the debug info path using lldb |
In our case, we were planning to remap Bazel's remote view of the workspace root directory to Regarding the overall question of this PR, I think it definitely makes sense to remap index store paths for the same reason, and I wish it had occurred to me when I implemented Adding |
Thanks @allevato. It's unknown whether we could use relative paths in the index store Perhaps someone from Apple might answer this. This pull request would only be useful if Xcode does support relative paths (ex |
I've learned more here, after making a tool to convert index store unit files. It ends up that other paths need to be remapped, not just source paths, including the |
For anyone curious, we've open sourced the tool that remaps paths of an index-store: https://github.com/lyft/index-import |
This change builds on #17665, which added
-debug-prefix-map
to rewrite source paths embedded in the debug info of outputs. This change uses same flag to also remap source paths embedded in the index store.The goal of this is just like the purpose of
-debug-prefix-map
, to produce artifacts (index store) that contain paths that refer to a known source path, not the build system's chosen build location. The end goal is to have indexes provided from a build cache.I haven't discussed this with anyone on the Swift team, there are a few things to discuss:
-debug-prefix-map
to include more than debug info? I think "debug" could be taken to mean outputs used for "development"TODO