[PATCH] D87928: Provide -fsource-dir flag in Clang

Keith Smiley via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 17:08:22 PDT 2020


keith added a comment.

In D87928#2282609 <https://reviews.llvm.org/D87928#2282609>, @phosek wrote:

> This change is trying to address the issues raised in D83154 <https://reviews.llvm.org/D83154>. There are still some open questions:
>
> - Is `-fsource-dir` the best name for this flag?

I think this name works as long as its recommended usage doesn't end up including directories outside of the source root.

> - I'm not sure if `make_relative` should be applied to all source paths, or only paths that start with `SourceDir` which would exclude system paths outside of the source directory (e.g. it's probably undesirable to relativize paths to `/usr/include`)?

This is one place where I think the `*-prefix-map` flags have a UX advantage. For example in the Apple toolchain, there are places where the Xcode paths are embedded in this data, and you may want to exclude them by doing `-f*-prefix-map=/path/to/Xcode.app=STANDARD_XCODE_PATH` and remapping that later as needed to increase reproducibility

> - If we decide to exclude source paths outside of the source directory, should we support `-fsource-dir` to be specified more then once to handle multiple source directories?

I think this would be a bit confusing usage wise, so I would say it should act like `-fdebug-compilation-dir` where only 1 can be passed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87928/new/

https://reviews.llvm.org/D87928



More information about the cfe-commits mailing list