This is an archive of the discontinued LLVM Phabricator instance.

Darwin: introduce a global override for debug prefix map entries
ClosedPublic

Authored by aprantl on Feb 15 2022, 8:28 AM.

Details

Summary

This patch adds a new Darwin clang driver environment variable in the spirit of RC_DEBUG_OPTIONS, called RC_DEBUG_PREFIX_MAP, which allows a meta build tool to add one additional -fdebug-prefix-map entry without the knowledge of the build system.

rdar://85224675

Diff Detail

Event Timeline

aprantl requested review of this revision.Feb 15 2022, 8:28 AM
aprantl created this revision.
arphaman added inline comments.Feb 15 2022, 9:11 AM
clang/lib/Driver/ToolChains/Clang.cpp
688

Suggestion: It might be good to factor out the code that verifies the value and either produces an error or adds an argument into some common helper as it's used right above this codepath as well.

aprantl updated this revision to Diff 408944.Feb 15 2022, 10:03 AM

Refactored code.

clang/lib/Driver/ToolChains/Clang.cpp
688

Good idea! Done.

arphaman accepted this revision.Feb 15 2022, 12:15 PM
This revision is now accepted and ready to land.Feb 15 2022, 12:15 PM
keith added a subscriber: keith.Feb 15 2022, 4:40 PM
thakis added a subscriber: thakis.Feb 16 2022, 7:13 AM

(I wish there was a flag that said "clang, never ever read any env vars please". Some people think that builds should be deterministic and not depend on random env vars people might have set (and then not do correct incremental rebuilds when the value of such env var flags change). But given that clang already reads a whole bunch of such env vars and we can always add such a flag later, I suppose this change doesn't make things that much worse.)

(I wish there was a flag that said "clang, never ever read any env vars please". Some people think that builds should be deterministic and not depend on random env vars people might have set (and then not do correct incremental rebuilds when the value of such env var flags change). But given that clang already reads a whole bunch of such env vars and we can always add such a flag later, I suppose this change doesn't make things that much worse.)

These are all good points. The environment variables are useful to side-step the many project-specific build systems that you have to deal with when building an entire OS and this is also the primary use-case here.

This revision was landed with ongoing or failed builds.Feb 16 2022, 8:36 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2022, 8:36 AM