This is an archive of the discontinued LLVM Phabricator instance.

[clang] [Driver] Do not transform explicit --config filename
ClosedPublic

Authored by mgorny on Sep 19 2022, 12:36 PM.

Details

Summary

Disable transformations (e.g. attempting to replace target architecture)
in the config filename that is passed explicitly via --config. This
behavior is surprising and confusing -- if user passes an explicit
config filename, Clang should use it as is. The transformations are
still applied when the name is deduced from filename.

Update the tests accordingly. This primarily ensures that full filename
with .cfg suffix is passed to --config (appending .cfg implicitly is
not documented, and would collide with use of filenames with other
suffixes). The config-file2.c suite is removed entirely as it tested
the transformations on the argument to --config. However, the aspects
of that that were not tested as part of config-file3.c are now added
there (based on config filename deduced from executable).

This change streamlines the code in Driver::loadConfigFile(), opening
the possibility of further changes, including support for handling
multiple --config options and refactoring of filename deduction.

Diff Detail

Event Timeline

mgorny created this revision.Sep 19 2022, 12:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 12:36 PM
Herald added a subscriber: StephenFan. · View Herald Transcript
mgorny requested review of this revision.Sep 19 2022, 12:36 PM
MaskRay accepted this revision.Sep 19 2022, 2:39 PM

Thanks!

This revision is now accepted and ready to land.Sep 19 2022, 2:39 PM
sepavloff accepted this revision.Sep 19 2022, 10:27 PM

LGTM.

Thanks!

Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 10:59 PM
clang/test/Driver/config-file.c