[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
Tue Sep 27 05:44:01 PDT 2022


mgorny updated this revision to Diff 463201.
mgorny edited the summary of this revision.
mgorny added a comment.

Ok, how about this variant? I think it's the simplest I can come up with that roughly matches the old behavior and adds what's necessary for the new.

The algorithm is to use:

1. `<triple>-<mode>.cfg` if available, using the real `<mode>`,
2. `<triple>-<mode>.cfg` if available, using `<mode>` inferred from executable name,
3. `<triple>.cfg` + `<mode>.cfg` if either is available, using the real `<mode>`,
4. `<triple>.cfg` + `<mode>.cfg` if either is available, using the `<mode>` inferred from executable.

The important features of this are:

1. Triple accounts for `-m32` and other options changing mode, so x86_64-specific configs won't be used when building 32-bit executables.
2. Triple accounts for executable prefix, so the existing configs will continue to work (presuming that your customers do not use `--target`, as you noted).
3. It accounts both for real mode and mode inferred from executable, so it will prefer the correct config when `--driver-mode=` is used but it will also work with existing configs that used different executable names.

Unlike the previous mode, there's no potential confusion between 32-bit and 64-bit configs, and the logic is definitely less confusing.


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

https://reviews.llvm.org/D134337

Files:
  clang/include/clang/Driver/Driver.h
  clang/lib/Driver/Driver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134337.463201.patch
Type: text/x-patch
Size: 6530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220927/8991c4ab/attachment-0001.bin>


More information about the cfe-commits mailing list