[all-commits] [llvm/llvm-project] 063e17: [clang] [Driver] More flexible rules for loading d...

Michał Górny via All-commits all-commits at lists.llvm.org
Thu Sep 29 12:00:37 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 063e17d8b04b41cd8bd174aebb6603eb1a76d34a
      https://github.com/llvm/llvm-project/commit/063e17d8b04b41cd8bd174aebb6603eb1a76d34a
  Author: Michał Górny <mgorny at gentoo.org>
  Date:   2022-09-29 (Thu, 29 Sep 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/docs/UsersManual.rst
    M clang/include/clang/Driver/Driver.h
    M clang/lib/Driver/Driver.cpp
    M clang/test/Driver/config-file3.c

  Log Message:
  -----------
  [clang] [Driver] More flexible rules for loading default configs

Change the default config file loading logic to be more flexible
and more readable at the same time.  The new algorithm focuses on four
locations, in order:

1. <triple>-<mode>.cfg using real driver mode
2. <triple>-<mode>.cfg using executable suffix
3. <triple>.cfg + <mode>.cfg using real driver mode
4. <triple>.cfg + <mode>.cfg using executable suffix

This is meant to preserve reasonable level of compatibility with
the existing use, while introducing more flexibility and making the code
simpler.  Notably:

1. In this layout, the actual target triple is normally respected,
   and e.g. in `-m32` build the `x86_64-*` configs will never be used.

2. Both real driver mode (preferable) and executable suffix are
   supported.  This permits correctly handling calls with explicit
   `--driver-mode=` while at the same time preserving compatibility
   with the existing code.

3. The first two locations provide users with the ability to override
   configuration per specific target+mode combinaton, while the next two
   make it possible to independently specify per-target and per-mode
   configuration.

4. All config file locations are applicable independently of whether
   clang is started via a prefixed executable, or bare `clang`.

5. If the target is not explicitly specified and the executable prefix
   does not name a valid triple, it is used instead of the actual target
   triple for backwards compatibility.

This is particularly meant to address Gentoo's use case for
configuration files: to configure the default runtimes (i.e. `-rtlib=`,
`-stdlib=`) and `--gcc-install-dir=` for all the relevant drivers,
as well as to make it more convenient for users to override `-W` flags
to test compatibility with future versions of Clang easier.

Differential Revision: https://reviews.llvm.org/D134337


  Commit: 74085ebfb68e067ba6c21722ac02d2ffbb42a00c
      https://github.com/llvm/llvm-project/commit/74085ebfb68e067ba6c21722ac02d2ffbb42a00c
  Author: Michał Górny <mgorny at gentoo.org>
  Date:   2022-09-29 (Thu, 29 Sep 2022)

  Changed paths:
    M clang/test/lit.cfg.py
    M llvm/utils/lit/lit/llvm/config.py

  Log Message:
  -----------
  [llvm] [lit] Move %clang_dxc substitution from clang/test

Move the `%clang_dxc` substitution from local definition in clang/test
to lit's `llvm/config.py` module where all other driver definitions
are found.  This improves consistency and makes it easier to control
global clang options.

Differential Revision: https://reviews.llvm.org/D134871


  Commit: 1609a5d7715c06ff52c13af8b20ee64811a8ec7b
      https://github.com/llvm/llvm-project/commit/1609a5d7715c06ff52c13af8b20ee64811a8ec7b
  Author: Michał Górny <mgorny at gentoo.org>
  Date:   2022-09-29 (Thu, 29 Sep 2022)

  Changed paths:
    M clang/test/CodeGenHLSL/disable_opt.hlsl
    M clang/test/CodeGenHLSL/validator_version.hlsl
    M clang/test/Driver/debug-options.c
    M clang/test/Driver/hlsl-entry.cpp
    M clang/test/Driver/hlsl_no_stdinc.hlsl
    M clang/test/Driver/linker-wrapper-image.c
    M clang/test/Driver/linker-wrapper.c
    M clang/test/Driver/lit.local.cfg
    M clang/test/Driver/offload-packager.c
    M clang/test/Driver/reloc-model.c
    M clang/test/Driver/riscv-features.c
    M clang/test/Frontend/plugin-attribute.cpp
    M clang/test/InterfaceStubs/externstatic.c

  Log Message:
  -----------
  [clang] [test] Use %clang_cc1 substitution consistently

Use the `%clang_cc1` substitution consistently across the test suite,
replacing inline `%clang -cc1` invocations, except for one Preprocessor
test where this is causing breakage.  This is necessary to ensure that
additional parameters passed via `%clang` do not interfere with `-cc1`
that must always be passed as the first command-line argument.

Remove the additional substitution blocking `%clang_cc1` use in Driver
tests.  It has been added in 2013 and was supposed to prevent tests
calling `clang -cc1` from being added to Driver.  The state of the test
suite proves that it did not succeed at all.

Differential Revision: https://reviews.llvm.org/D134880


Compare: https://github.com/llvm/llvm-project/compare/062e515b7019...1609a5d7715c


More information about the All-commits mailing list