<NME> cmdline-objc_gc_only.objtxt
<BEF> ADDFILE
<MSG> Add the GC commandline options and throw errors if they are used

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@257907 91177308-0d34-0410-b5e6-96231b3b80d8

<DFF> @@ -0,0 +1,15 @@
+# RUN: not lld -flavor darwin -arch x86_64 -objc_gc_only %s 2>&1 | FileCheck %s
+#
+# Test that the -objc_gc_only is rejected.
+#
+
+# CHECK: error: -objc_gc_only is not supported
+
+--- !native
+defined-atoms:
+    - name:              _main
+      type:              code
+      scope:             global
+      content:           [ 0x90 ]
+
+...

{'commit': 'diff --git a/lib/Driver/DarwinLdDriver.cpp b/lib/Driver/DarwinLdDriver.cpp\nindex 40fad74c9..984958c90 100644\n--- a/lib/Driver/DarwinLdDriver.cpp\n+++ b/lib/Driver/DarwinLdDriver.cpp\n@@ -673,6 +673,22 @@ bool DarwinLdDriver::parse(llvm::ArrayRef<const char *> args,\n     }\n   }\n \n+  // Handle obsolete ObjC options: -objc_gc_compaction, -objc_gc, -objc_gc_only\n+  if (parsedArgs.getLastArg(OPT_objc_gc_compaction)) {\n+    diagnostics << "error: -objc_gc_compaction is not supported\\n";\n+    return false;\n+  }\n+\n+  if (parsedArgs.getLastArg(OPT_objc_gc)) {\n+    diagnostics << "error: -objc_gc is not supported\\n";\n+    return false;\n+  }\n+\n+  if (parsedArgs.getLastArg(OPT_objc_gc_only)) {\n+    diagnostics << "error: -objc_gc_only is not supported\\n";\n+    return false;\n+  }\n+\n   // Handle -pie or -no_pie\n   if (llvm::opt::Arg *pie = parsedArgs.getLastArg(OPT_pie, OPT_no_pie)) {\n     switch (ctx.outputMachOType()) {\ndiff --git a/lib/Driver/DarwinLdOptions.td b/lib/Driver/DarwinLdOptions.td\nindex cbf6ac1d4..2fad19cc2 100644\n--- a/lib/Driver/DarwinLdOptions.td\n+++ b/lib/Driver/DarwinLdOptions.td\n@@ -205,3 +205,9 @@ def single_module : Flag<["-"], "single_module">,\n      HelpText<"Default for dylibs">, Group<grp_obsolete>;\n def multi_module : Flag<["-"], "multi_module">,\n      HelpText<"Unsupported way to build dylibs">, Group<grp_obsolete>;\n+def objc_gc_compaction : Flag<["-"], "objc_gc_compaction">,\n+     HelpText<"Unsupported ObjC GC option">, Group<grp_obsolete>;\n+def objc_gc : Flag<["-"], "objc_gc">,\n+     HelpText<"Unsupported ObjC GC option">, Group<grp_obsolete>;\n+def objc_gc_only : Flag<["-"], "objc_gc_only">,\n+     HelpText<"Unsupported ObjC GC option">, Group<grp_obsolete>;\ndiff --git a/test/darwin/cmdline-objc_gc.objtxt b/test/darwin/cmdline-objc_gc.objtxt\nnew file mode 100644\nindex 000000000..b5225a1d1\n--- /dev/null\n+++ b/test/darwin/cmdline-objc_gc.objtxt\n@@ -0,0 +1,15 @@\n+# RUN: not lld -flavor darwin -arch x86_64 -objc_gc %s 2>&1 | FileCheck %s\n+#\n+# Test that the -objc_gc is rejected.\n+#\n+\n+# CHECK: error: -objc_gc is not supported\n+\n+--- !native\n+defined-atoms:\n+    - name:              _main\n+      type:              code\n+      scope:             global\n+      content:           [ 0x90 ]\n+\n+...\ndiff --git a/test/darwin/cmdline-objc_gc_compaction.objtxt b/test/darwin/cmdline-objc_gc_compaction.objtxt\nnew file mode 100644\nindex 000000000..acf7183d9\n--- /dev/null\n+++ b/test/darwin/cmdline-objc_gc_compaction.objtxt\n@@ -0,0 +1,15 @@\n+# RUN: not lld -flavor darwin -arch x86_64 -objc_gc_compaction %s 2>&1 | FileCheck %s\n+#\n+# Test that the -objc_gc_compaction is rejected.\n+#\n+\n+# CHECK: error: -objc_gc_compaction is not supported\n+\n+--- !native\n+defined-atoms:\n+    - name:              _main\n+      type:              code\n+      scope:             global\n+      content:           [ 0x90 ]\n+\n+...\ndiff --git a/test/darwin/cmdline-objc_gc_only.objtxt b/test/darwin/cmdline-objc_gc_only.objtxt\nnew file mode 100644\nindex 000000000..db1cef94e\n--- /dev/null\n+++ b/test/darwin/cmdline-objc_gc_only.objtxt\n@@ -0,0 +1,15 @@\n+# RUN: not lld -flavor darwin -arch x86_64 -objc_gc_only %s 2>&1 | FileCheck %s\n+#\n+# Test that the -objc_gc_only is rejected.\n+#\n+\n+# CHECK: error: -objc_gc_only is not supported\n+\n+--- !native\n+defined-atoms:\n+    - name:              _main\n+      type:              code\n+      scope:             global\n+      content:           [ 0x90 ]\n+\n+...\n', 'commit_subject': 'Add the GC commandline options and throw errors if they are used', 'repo_name': 'llvm-mirror/lld', 'committer': {'name': 'Pete Cooper', 'email': '607a4aeae37c8a26eb86f95c436fb926ad94d55c@apple.com', 'time_sec': '1452879542', 'tz_offset': '0', 'date': {'seconds': '1452879542'}}, 'commit_tree': '5adec4ea0877ba050ffeeadc587d6d073b8c54c6', 'commit_message': 'Add the GC commandline options and throw errors if they are used\n\ngit-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@257907 91177308-0d34-0410-b5e6-96231b3b80d8\n', 'language_name': 'C++', 'license': 'apache-2.0', 'hunks': '@@ -0,0 +1,15 @@\n+# RUN: not lld -flavor darwin -arch x86_64 -objc_gc_only %s 2>&1 | FileCheck %s\n+#\n+# Test that the -objc_gc_only is rejected.\n+#\n+\n+# CHECK: error: -objc_gc_only is not supported\n+\n+--- !native\n+defined-atoms:\n+    - name:              _main\n+      type:              code\n+      scope:             global\n+      content:           [ 0x90 ]\n+\n+...\n', 'addition_count': 15, 'deletion_count': 0, 'src_file': '/dev/null', 'tgt_file': 'b/test/darwin/cmdline-objc_gc_only.objtxt', 'file_extension': '.objtxt', 'before_file': 'ADDFILE', 'message': 'Add the GC commandline options and throw errors if they are used\n\ngit-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@257907 91177308-0d34-0410-b5e6-96231b3b80d8\n', 'author_name': 'Pete Cooper', 'lang': 'objtxt'}