Add -fno-blocks support. This fixes block-no-block-def.c.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63385 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 4e79733..b16a836 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -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.
diff --git a/tools/ccc/ccclib/Arguments.py b/tools/ccc/ccclib/Arguments.py
index 0f258cf..dcf1e70 100644
--- a/tools/ccc/ccclib/Arguments.py
+++ b/tools/ccc/ccclib/Arguments.py
@@ -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))
diff --git a/tools/ccc/ccclib/Tools.py b/tools/ccc/ccclib/Tools.py
index 6156684c..a86ab9b 100644
--- a/tools/ccc/ccclib/Tools.py
+++ b/tools/ccc/ccclib/Tools.py
@@ -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