instead of forcing blocks on by default, make them default to off, but let
specific targets default them to on. Default blocks to on on 10.6 and later.
Add a -fblocks option that allows the user to override the target's default.
Use -fblocks in the various testcases that use blocks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60563 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index bb838ed..303bfe7 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -462,6 +462,9 @@
llvm::cl::desc("Allow implicit conversions between vectors"
" 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"));
+
// FIXME: This (and all GCC -f options) really come in -f... and
// -fno-... forms, and additionally support automagic behavior when
@@ -494,7 +497,6 @@
// FIXME: add:
// -fdollars-in-identifiers
-// -fpascal-strings
static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
TargetInfo *Target) {
// Allow the target to set the default the langauge options as it sees fit.
@@ -570,11 +572,14 @@
Options.Trigraphs = LangStd < lang_gnu_START || Trigraphs ? 1 : 0;
Options.DollarIdents = 1; // FIXME: Really a target property.
- Options.PascalStrings = PascalStrings;
+ if (PascalStrings.getPosition())
+ Options.PascalStrings = PascalStrings;
Options.Microsoft = MSExtensions;
Options.WritableStrings = WritableStrings;
Options.LaxVectorConversions = LaxVectorConversions;
Options.Exceptions = Exceptions;
+ if (EnableBlocks.getPosition())
+ Options.Blocks = EnableBlocks;
// Override the default runtime if the user requested it.
if (NeXTRuntime)