[PATCH] D52956: Support `-fno-visibility-inlines-hidden`

Andrew Gallagher via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 5 17:10:15 PDT 2018


andrewjcg created this revision.
Herald added subscribers: cfe-commits, eraman.

Undoes `-fvisibility-inlines-hidden`.

Test Plan: added test


Repository:
  rC Clang

https://reviews.llvm.org/D52956

Files:
  include/clang/Driver/Options.td
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/visibility-inlines-hidden.cpp


Index: test/Driver/visibility-inlines-hidden.cpp
===================================================================
--- /dev/null
+++ test/Driver/visibility-inlines-hidden.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang -### -S -fvisibility-inlines-hidden %s 2> %t.log
+// RUN: FileCheck -check-prefix=CHECK-1 %s < %t.log
+// CHECK-1: "-fvisibility-inlines-hidden"
+// CHECK-1-NOT: "-fno-visibility-inlines-hidden"
+
+// RUN: %clang -### -S -fno-visibility-inlines-hidden %s 2> %t.log
+// RUN: FileCheck -check-prefix=CHECK-2 %s < %t.log
+// CHECK-2: "-fno-visibility-inlines-hidden"
+// CHECK-2-NOT: "-fvisibility-inlines-hidden"
+
+// RUN: %clang -### -S -fvisibility-inlines-hidden -fno-visibility-inlines-hidden %s 2> %t.log
+// RUN: FileCheck -check-prefix=CHECK-3 %s < %t.log
+// CHECK-3: "-fno-visibility-inlines-hidden"
+// CHECK-3-NOT: "-fvisibility-inlines-hidden"
+
+// RUN: %clang -### -S -fno-visibility-inlines-hidden -fvisibility-inlines-hidden %s 2> %t.log
+// RUN: FileCheck -check-prefix=CHECK-4 %s < %t.log
+// CHECK-4: "-fvisibility-inlines-hidden"
+// CHECK-4-NOT: "-fno-visibility-inlines-hidden"
Index: lib/Frontend/CompilerInvocation.cpp
===================================================================
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2310,8 +2310,11 @@
     Opts.setTypeVisibilityMode(Opts.getValueVisibilityMode());
   }
 
-  if (Args.hasArg(OPT_fvisibility_inlines_hidden))
+  if (Args.hasFlag(OPT_fvisibility_inlines_hidden,
+                   OPT_fno_visibility_inlines_hidden,
+                   false)) {
     Opts.InlineVisibilityHidden = 1;
+  }
 
   if (Args.hasArg(OPT_ftrapv)) {
     Opts.setSignedOverflowBehavior(LangOptions::SOB_Trapping);
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -4167,7 +4167,8 @@
     }
   }
 
-  Args.AddLastArg(CmdArgs, options::OPT_fvisibility_inlines_hidden);
+  Args.AddLastArg(CmdArgs, options::OPT_fvisibility_inlines_hidden,
+                  options::OPT_fno_visibility_inlines_hidden);
 
   Args.AddLastArg(CmdArgs, options::OPT_ftlsmodel_EQ);
 
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1714,6 +1714,9 @@
 def fvisibility_inlines_hidden : Flag<["-"], "fvisibility-inlines-hidden">, Group<f_Group>,
   HelpText<"Give inline C++ member functions hidden visibility by default">,
   Flags<[CC1Option]>;
+def fno_visibility_inlines_hidden : Flag<["-"], "fno-visibility-inlines-hidden">, Group<f_Group>,
+  HelpText<"Do not give inline C++ member functions hidden visibility by default">,
+  Flags<[CC1Option]>;
 def fvisibility_ms_compat : Flag<["-"], "fvisibility-ms-compat">, Group<f_Group>,
   HelpText<"Give global types 'default' visibility and global functions and "
            "variables 'hidden' visibility by default">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52956.168554.patch
Type: text/x-patch
Size: 3025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181006/61749962/attachment.bin>


More information about the cfe-commits mailing list