[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:31:12 PDT 2023


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

>From d056372043e9ee55caf4a7c8d1f708658986cfd1 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 | 1 +
 flang/test/Driver/driver-help.f90        | 1 +
 flang/test/Driver/misc-flags.f90         | 3 +++
 4 files changed, 7 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..eddf7d0d59794a0 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
diff --git a/flang/test/Driver/driver-help.f90 b/flang/test/Driver/driver-help.f90
index 4894f90f5310439..5c3273d825600a0 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
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