r252912 - Add support for driver option -mno-ms-bitfields.

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 09:21:23 PST 2015


Author: ahatanak
Date: Thu Nov 12 11:21:22 2015
New Revision: 252912

URL: http://llvm.org/viewvc/llvm-project?rev=252912&view=rev
Log:
Add support for driver option -mno-ms-bitfields.

This option is used to cancel -mms-bitfields on the command line.

rdar://problem/15898553

Added:
    cfe/trunk/test/Driver/ms-bitfields.c
Modified:
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=252912&r1=252911&r2=252912&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Nov 12 11:21:22 2015
@@ -1273,6 +1273,8 @@ def mmacosx_version_min_EQ : Joined<["-"
   Group<m_Group>, HelpText<"Set Mac OS X deployment target">;
 def mms_bitfields : Flag<["-"], "mms-bitfields">, Group<m_Group>, Flags<[CC1Option]>,
   HelpText<"Set the default structure layout to be compatible with the Microsoft compiler standard">;
+def mno_ms_bitfields : Flag<["-"], "mno-ms-bitfields">, Group<m_Group>,
+  HelpText<"Do not set the default structure layout to be compatible with the Microsoft compiler standard">;
 def mstackrealign : Flag<["-"], "mstackrealign">, Group<m_Group>, Flags<[CC1Option]>,
   HelpText<"Force realign the stack at entry to every function">;
 def mstack_alignment : Joined<["-"], "mstack-alignment=">, Group<m_Group>, Flags<[CC1Option]>,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=252912&r1=252911&r2=252912&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Nov 12 11:21:22 2015
@@ -3713,7 +3713,8 @@ void Clang::ConstructJob(Compilation &C,
   if (KernelOrKext && getToolChain().getTriple().isOSDarwin())
     CmdArgs.push_back("-fforbid-guard-variables");
 
-  if (Args.hasArg(options::OPT_mms_bitfields)) {
+  if (Args.hasFlag(options::OPT_mms_bitfields, options::OPT_mno_ms_bitfields,
+                   false)) {
     CmdArgs.push_back("-mms-bitfields");
   }
 

Added: cfe/trunk/test/Driver/ms-bitfields.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ms-bitfields.c?rev=252912&view=auto
==============================================================================
--- cfe/trunk/test/Driver/ms-bitfields.c (added)
+++ cfe/trunk/test/Driver/ms-bitfields.c Thu Nov 12 11:21:22 2015
@@ -0,0 +1,6 @@
+// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS
+// RUN: %clang -### -mno-ms-bitfields -mms-bitfields %s 2>&1 | FileCheck %s -check-prefix=MSBITFIELDS
+// RUN: %clang -### -mms-bitfields -mno-ms-bitfields %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS
+
+// MSBITFIELDS: -mms-bitfields
+// NO-MSBITFIELDS-NOT: -mms-bitfields




More information about the cfe-commits mailing list