This will match the behavior of GCC.
Patch does not change remapping logic itself, so adding one simple smoke test should be enough.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks!
clang/test/CodeGen/macro-prefix-map.c | ||
---|---|---|
1 ↗ | (On Diff #363838) | The test may be placed in CodeGenCXX/builtin-source-location.cpp |
Could you please land it? I don't have commit access.
Also, any chance this patch can get into 13.x release branch? Not sure if it counts as a feature or a bugfix :)
I can push it on your behalf, I want to wait a bit for more comments.
(You need to provide name/email so that you can get the proper attribution git commit --amend --author='...')
Looks like a good candidate for release/13.x for build reproducibility.
absl has a macro saying whether __builtin_FILE can be used.
I can find a few other places where people do something like -D__builtin_FILE()="file.cc" probably to work around Clang.
clang/include/clang/Driver/Options.td HelpText for -fmacro-prefix-map= needs an update.
https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html has more documentation
Great! My commit author string is Pavel Asyutchenko <sventeam@yandex.ru>.
I have an even uglier hack to work around this: to offset the value of __builtin_FILE() by compile-time calculated location of some known substring like src or include.
Updated ffile-prefix-map and fmacro-prefix-map in clang/include/clang/Driver/Options.td.
Created release/13.x merge request: https://bugs.llvm.org/show_bug.cgi?id=51350
The release manager makes the call.