[clang] 08af5ba - [Driver] Add --config= as canonical spelling of --config
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 29 00:38:20 PDT 2022
Author: Fangrui Song
Date: 2022-09-29T00:38:12-07:00
New Revision: 08af5ba3713523d9596a414e6a64b26494199fdd
URL: https://github.com/llvm/llvm-project/commit/08af5ba3713523d9596a414e6a64b26494199fdd
DIFF: https://github.com/llvm/llvm-project/commit/08af5ba3713523d9596a414e6a64b26494199fdd.diff
LOG: [Driver] Add --config= as canonical spelling of --config
Driver options usually use `Joined` instead of `Separate`. It is also weird that
`--config-system-dir=`/etc exist while `--config=` did not exist.
Reviewed By: mgorny
Differential Revision: https://reviews.llvm.org/D134790
Added:
Modified:
clang/docs/UsersManual.rst
clang/include/clang/Driver/Options.td
clang/test/Driver/config-file.c
Removed:
################################################################################
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 9c0a916f1a10d..d4c66e661dac5 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -887,14 +887,14 @@ Configuration files can be either specified on the command line or loaded
from default locations. If both variants are present, the default configuration
files are loaded first.
-The command line option ``--config`` can be used to specify explicit
+The command line option ``--config=`` can be used to specify explicit
configuration files in a Clang invocation. If the option is used multiple times,
all specified files are loaded, in order. For example:
::
- clang --config /home/user/cfgs/testing.txt
- clang --config debug.cfg --config runtimes.cfg
+ clang --config=/home/user/cfgs/testing.txt
+ clang --config=debug.cfg --config=runtimes.cfg
If the provided argument contains a directory separator, it is considered as
a file path, and options are read from that file. Otherwise the argument is
@@ -966,7 +966,7 @@ configuration file.
In cases where a configuration file is deployed alongside SDK contents, the
SDK directory can remain fully portable by using ``<CFGDIR>`` prefixed paths.
In this way, the user may only need to specify a root configuration file with
-``--config`` to establish every aspect of the SDK with the compiler:
+``--config=`` to establish every aspect of the SDK with the compiler:
::
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 61ffaf9d04dbd..116a12065da77 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -900,8 +900,9 @@ def cl_ext_EQ : CommaJoined<["-"], "cl-ext=">, Group<opencl_Group>, Flags<[CC1Op
def client__name : JoinedOrSeparate<["-"], "client_name">;
def combine : Flag<["-", "--"], "combine">, Flags<[NoXarchOption, Unsupported]>;
def compatibility__version : JoinedOrSeparate<["-"], "compatibility_version">;
-def config : Separate<["--"], "config">, Flags<[NoXarchOption, CoreOption]>,
- HelpText<"Specifies configuration file">;
+def config : Joined<["--"], "config=">, Flags<[NoXarchOption, CoreOption]>, MetaVarName<"<file>">,
+ HelpText<"Specify configuration file">;
+def : Separate<["--"], "config">, Alias<config>;
def no_default_config : Flag<["--"], "no-default-config">, Flags<[NoXarchOption, CoreOption]>,
HelpText<"Disable loading default configuration files">;
def config_system_dir_EQ : Joined<["--"], "config-system-dir=">, Flags<[NoXarchOption, CoreOption, HelpHidden]>,
diff --git a/clang/test/Driver/config-file.c b/clang/test/Driver/config-file.c
index 5cb2e485e1787..9c8d5be575f3c 100644
--- a/clang/test/Driver/config-file.c
+++ b/clang/test/Driver/config-file.c
@@ -8,6 +8,7 @@
//--- Config file (full path) in output of -###
//
// RUN: %clang --config %S/Inputs/config-1.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-HHH
+// RUN: %clang --config=%S/Inputs/config-1.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-HHH
// CHECK-HHH: Configuration file: {{.*}}Inputs{{.}}config-1.cfg
// CHECK-HHH: -Werror
// CHECK-HHH: -std=c99
More information about the cfe-commits
mailing list