$ svn merge -c -96793 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/Apple/Hermes
--- Reverse-merging r96793 into '.':
U    gcc/cp/cp-lang.c
U    gcc/cp/parser.c
U    gcc/c-lang.c

llvm-svn: 96929
diff --git a/llvm-gcc-4.2/gcc/c-lang.c b/llvm-gcc-4.2/gcc/c-lang.c
index c837f7f..81fb05b 100644
--- a/llvm-gcc-4.2/gcc/c-lang.c
+++ b/llvm-gcc-4.2/gcc/c-lang.c
@@ -88,11 +88,6 @@
 void
 finish_file (void)
 {
-  /* APPLE LOCAL begin radar 4874613 */
-  /* Bad parse errors.  Just forget about it.  */
-  if (!errorcount && !sorrycount && pch_file)
-    c_common_write_pch ();
-  /* APPLE LOCAL end radar 4874613 */
 }
 
 #include "gtype-c.h"
diff --git a/llvm-gcc-4.2/gcc/cp/cp-lang.c b/llvm-gcc-4.2/gcc/cp/cp-lang.c
index 95c5047..9605272 100644
--- a/llvm-gcc-4.2/gcc/cp/cp-lang.c
+++ b/llvm-gcc-4.2/gcc/cp/cp-lang.c
@@ -149,12 +149,6 @@
 finish_file (void)
 {
   cp_finish_file ();
-  /* APPLE LOCAL begin radar 4874613 */
-  /* Bad parse errors.  Just forget about it.  */
-  if (pch_file && lang_hooks.decls.global_bindings_p () &&
-      !current_class_type && !decl_namespace_list)
-    c_common_write_pch ();
-  /* APPLE LOCAL end radar 4874613 */
 }
 
 #include "gtype-cp.h"
diff --git a/llvm-gcc-4.2/gcc/cp/parser.c b/llvm-gcc-4.2/gcc/cp/parser.c
index 62c0cd1..45358f0 100644
--- a/llvm-gcc-4.2/gcc/cp/parser.c
+++ b/llvm-gcc-4.2/gcc/cp/parser.c
@@ -23492,6 +23492,13 @@
 				? dk_no_deferred : dk_no_check);
   error_occurred = cp_parser_translation_unit (the_parser);
   the_parser = NULL;
+  /* APPLE LOCAL begin radar 4874613 */
+  /* Bad parse errors.  Just forget about it.  */
+  if (! global_bindings_p () || current_class_type || decl_namespace_list)
+    return;
+  if (pch_file)
+    c_common_write_pch ();
+  /* APPLE LOCAL end radar 4874613 */
 }
 
 /* This variable must be provided by every front end.  */