[PATCH] D134337: [clang] [Driver] More flexible rules for loading default configs (WIP)

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 21 01:03:22 PDT 2022


mgorny created this revision.
mgorny added reviewers: sepavloff, MaskRay.
Herald added subscribers: StephenFan, pengfei.
Herald added a reviewer: sscalpone.
Herald added a project: All.
mgorny requested review of this revision.

Update the rules used to load default configuration files to permit
more flexible setups.  Attempt to find `<TARGET>-<MODE>.cfg` first,
and fall back to loading *both* `<TARGET>.cfg` and `<MODE>.cfg` if it
does not exist.

While looking for the file, attempt three filenames, in order:

1. The effective target (i.e. respecting `-target`) and effective driver mode (i.e. respecting `--driver-mode`).

2. The prefix and mode suffix deduced from the filename, with the architecture part substituted to match the effective target.

3. The original prefix and mode suffix from the filename.

When looking for the split configs, try the three prefixes and two mode
suffixes respectively.

One notable change in behavior is that the full filename deduced from
the original prefix and mode suffix (e.g. `x86_64-clang.cfg`) will now
take precedence over the file containing only the "fixed" prefix (e.g.
`i386.cfg`).  Unfortunately, there does not seem to be a clean way of
preserving backwards compatibility without introducing confusing
behavior.

TODO: update docs & tests


https://reviews.llvm.org/D134337

Files:
  clang/lib/Driver/Driver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134337.461805.patch
Type: text/x-patch
Size: 6389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220921/84d10f78/attachment-0001.bin>


More information about the cfe-commits mailing list