[flang-commits] [flang] [flang][driver] Mark -fcommon and -mtune as visible in Flang (PR #68657)

Fangcao Wang via flang-commits flang-commits at lists.llvm.org
Tue Oct 10 00:43:00 PDT 2023


https://github.com/LittleMeepo updated https://github.com/llvm/llvm-project/pull/68657

>From b7de162c0cd91864b1637ec184457b825e8727bc Mon Sep 17 00:00:00 2001
From: wangfc <wangfangcao1 at huawei.com>
Date: Tue, 10 Oct 2023 11:06:11 +0800
Subject: [PATCH] [flang][driver] Mark -fcommon and -mtune as visible in Flang

---
 clang/include/clang/Driver/Options.td    | 3 ++-
 flang/test/Driver/driver-help-hidden.f90 | 2 ++
 flang/test/Driver/driver-help.f90        | 2 ++
 flang/test/Driver/misc-flags.f90         | 3 +++
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 5415b18d3f406df..8936df388d2db97 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1786,7 +1786,7 @@ def fno_record_command_line : Flag<["-"], "fno-record-command-line">,
 def : Flag<["-"], "frecord-gcc-switches">, Alias<frecord_command_line>;
 def : Flag<["-"], "fno-record-gcc-switches">, Alias<fno_record_command_line>;
 def fcommon : Flag<["-"], "fcommon">, Group<f_Group>,
-  Visibility<[ClangOption, CLOption, CC1Option]>,
+  Visibility<[ClangOption, CLOption, CC1Option, FlangOption]>,
   HelpText<"Place uninitialized global variables in a common block">,
   MarshallingInfoNegativeFlag<CodeGenOpts<"NoCommon">>,
   DocBrief<[{Place definitions of variables with no storage class and no initializer
@@ -5077,6 +5077,7 @@ def module_file_info : Flag<["-"], "module-file-info">, Flags<[NoXarchOption]>,
   HelpText<"Provide information about a particular module file">;
 def mthumb : Flag<["-"], "mthumb">, Group<m_Group>;
 def mtune_EQ : Joined<["-"], "mtune=">, Group<m_Group>,
+  Flags<[TargetSpecific]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
   HelpText<"Only supported on AArch64, PowerPC, RISC-V, SystemZ, and X86">;
 def multi__module : Flag<["-"], "multi_module">;
 def multiply__defined__unused : Separate<["-"], "multiply_defined_unused">;
diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90
index 807b0f938d27b5c..55eb03256aa33bc 100644
--- a/flang/test/Driver/driver-help-hidden.f90
+++ b/flang/test/Driver/driver-help-hidden.f90
@@ -29,6 +29,7 @@
 ! CHECK-NEXT: -fapprox-func           Allow certain math function calls to be replaced with an approximately equivalent calculation
 ! CHECK-NEXT: -fbackslash             Specify that backslash in string introduces an escape character
 ! CHECK-NEXT: -fcolor-diagnostics     Enable colors in diagnostics
+! CHECK-NEXT: -fcommon                Place uninitialized global variables in a common block
 ! CHECK-NEXT: -fconvert=<value>       Set endian conversion of data for unformatted files
 ! CHECK-NEXT: -fdefault-double-8      Set the default double precision kind to an 8 byte wide type
 ! CHECK-NEXT: -fdefault-integer-8     Set the default integer and logical kind to an 8 byte wide type
@@ -112,6 +113,7 @@
 ! CHECK-NEXT: -module-dir <dir>       Put MODULE files in <dir>
 ! CHECK-NEXT: -msve-vector-bits=<value>
 ! CHECK-NEXT:                          Specify the size in bits of an SVE vector register. Defaults to the vector length agnostic value of "scalable". (AArch64 only)
+! CHECK-NEXT: -mtune=<value>          Only supported on AArch64, PowerPC, RISC-V, SystemZ, and X86
 ! CHECK-NEXT: --no-offload-arch=<value>
 ! CHECK-NEXT:                         Remove CUDA/HIP offloading device architecture (e.g. sm_35, gfx906) from the list of devices to compile for. 'all' resets the list to its default value.
 ! CHECK-NEXT: -nocpp                  Disable predefined and command line preprocessor macros
diff --git a/flang/test/Driver/driver-help.f90 b/flang/test/Driver/driver-help.f90
index 4894f90f5310439..289bf3397250f2d 100644
--- a/flang/test/Driver/driver-help.f90
+++ b/flang/test/Driver/driver-help.f90
@@ -25,6 +25,7 @@
 ! HELP-NEXT: -fapprox-func           Allow certain math function calls to be replaced with an approximately equivalent calculation
 ! HELP-NEXT: -fbackslash             Specify that backslash in string introduces an escape character
 ! HELP-NEXT: -fcolor-diagnostics     Enable colors in diagnostics
+! HELP-NEXT: -fcommon                Place uninitialized global variables in a common block
 ! HELP-NEXT: -fconvert=<value>       Set endian conversion of data for unformatted files
 ! HELP-NEXT: -fdefault-double-8      Set the default double precision kind to an 8 byte wide type
 ! HELP-NEXT: -fdefault-integer-8     Set the default integer and logical kind to an 8 byte wide type
@@ -100,6 +101,7 @@
 ! HELP-NEXT: -module-dir <dir>       Put MODULE files in <dir>
 ! HELP-NEXT: -msve-vector-bits=<value>
 ! HELP-NEXT:                          Specify the size in bits of an SVE vector register. Defaults to the vector length agnostic value of "scalable". (AArch64 only)
+! HELP-NEXT: -mtune=<value>          Only supported on AArch64, PowerPC, RISC-V, SystemZ, and X86
 ! HELP-NEXT: --no-offload-arch=<value>
 ! HELP-NEXT:                         Remove CUDA/HIP offloading device architecture (e.g. sm_35, gfx906) from the list of devices to compile for. 'all' resets the list to its default value.
 ! HELP-NEXT: -nocpp                  Disable predefined and command line preprocessor macros
diff --git a/flang/test/Driver/misc-flags.f90 b/flang/test/Driver/misc-flags.f90
index 61d763c5b64dd21..9412ccb8347ff89 100644
--- a/flang/test/Driver/misc-flags.f90
+++ b/flang/test/Driver/misc-flags.f90
@@ -10,6 +10,9 @@
 ! Make sure that `-L' is "visible" to Flang's driver
 ! RUN: %flang -L/ -### %s
 
+! Make sure that `-fcommon' is "visible" to Flang's driver
+! RUN: %flang -fcommon -### %s
+
 program hello
   write(*,*), "Hello world!"
 end program hello



More information about the flang-commits mailing list