[cfe-commits] r63385 - in /cfe/trunk: Driver/clang.cpp tools/ccc/ccclib/Arguments.py tools/ccc/ccclib/Tools.py

Mike Stump mrs at apple.com
Fri Jan 30 00:22:07 PST 2009


Author: mrs
Date: Fri Jan 30 02:22:07 2009
New Revision: 63385

URL: http://llvm.org/viewvc/llvm-project?rev=63385&view=rev
Log:
Add -fno-blocks support.  This fixes block-no-block-def.c.

Modified:
    cfe/trunk/Driver/clang.cpp
    cfe/trunk/tools/ccc/ccclib/Arguments.py
    cfe/trunk/tools/ccc/ccclib/Tools.py

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=63385&r1=63384&r2=63385&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Fri Jan 30 02:22:07 2009
@@ -486,7 +486,10 @@
                                     " with a different number of elements or "
                                     "different element types"));
 static llvm::cl::opt<bool>
-EnableBlocks("fblocks", llvm::cl::desc("enable the 'blocks' language feature"));
+EnableBlocks("fblocks", llvm::cl::desc("enable the 'blocks' language feature"), llvm::cl::ValueDisallowed);
+
+static llvm::cl::inverse_opt
+DisableBlocks("fno-blocks", llvm::cl::opposite_of(EnableBlocks), llvm::cl::ValueDisallowed);
 
 static llvm::cl::opt<bool>
 ObjCNonFragileABI("fobjc-nonfragile-abi", llvm::cl::desc("enable objective-c's nonfragile abi"));
@@ -614,7 +617,7 @@
   Options.WritableStrings = WritableStrings;
   Options.LaxVectorConversions = LaxVectorConversions;
   Options.Exceptions = Exceptions;
-  if (EnableBlocks.getPosition())
+  if (EnableBlocks.getPosition() || DisableBlocks.getPosition())
     Options.Blocks = EnableBlocks;
 
   // Override the default runtime if the user requested it.

Modified: cfe/trunk/tools/ccc/ccclib/Arguments.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Arguments.py?rev=63385&r1=63384&r2=63385&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Arguments.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Arguments.py Fri Jan 30 02:22:07 2009
@@ -768,6 +768,11 @@
         # want to avoid passing them to gcc/cc1 (which will generally
         # not eat them), or should we let the user sort it out.
 
+        self.fblocksGroup = OptionGroup('-fblocks')
+        self.f_blocks = self.addOption(FlagOption('-fblocks', self.fblocksGroup))
+        self.f_noblocks = self.addOption(FlagOption('-fno-blocks', self.fblocksGroup))
+        # self.fblocksOption = self.addOption(JoinedOption('-fblocks', self.fblocksGroup))
+        
         self.fGroup = OptionGroup('-f')
         self.fastOption = self.addOption(FlagOption('-fast', self.fGroup))
         self.fastfOption = self.addOption(FlagOption('-fastf', self.fGroup))

Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=63385&r1=63384&r2=63385&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Fri Jan 30 02:22:07 2009
@@ -305,8 +305,7 @@
                 cmd_args.append('-token-cache')
                 cmd_args.append(pthPath)
 
-        # FIXME: Dehardcode this.
-        cmd_args.append('-fblocks')
+        arglist.addAllArgs(cmd_args, arglist.parser.fblocksGroup)
 
         arglist.addAllArgs(cmd_args, arglist.parser.OOption)
         arglist.addAllArgs2(cmd_args, arglist.parser.ClangWGroup, arglist.parser.pedanticGroup)
@@ -466,6 +465,7 @@
         # ccc treats -fsyntax-only specially.
         arglist.addAllArgs2(cmd_args, arglist.parser.fGroup, 
                             arglist.parser.syntaxOnlyOption)
+        arglist.addAllArgs(cmd_args, arglist.parser.fblocksGroup)
 
         arglist.addAllArgs(cmd_args, arglist.parser.undefOption)
         if arglist.getLastArg(arglist.parser.QnOption):
@@ -538,6 +538,7 @@
         # ccc treats -fsyntax-only specially.
         arglist.addAllArgs2(cmd_args, arglist.parser.fGroup, 
                             arglist.parser.syntaxOnlyOption)
+        arglist.addAllArgs(cmd_args, arglist.parser.fblocksGroup)
 
         if (arglist.getLastArg(arglist.parser.gGroup) and
             not arglist.getLastArg(arglist.parser.g0Option) and





More information about the cfe-commits mailing list