Index: lib/Format/Format.cpp
===================================================================
--- lib/Format/Format.cpp	(revision 221760)
+++ lib/Format/Format.cpp	(working copy)
@@ -785,7 +785,9 @@
       Tok->SpacesRequiredBefore = 0;
       Tok->CanBreakBefore = true;
       return 1;
-    } else if (Limit != 0 && Line.First->isNot(tok::kw_namespace)) {
+    } else if (Limit != 0 && Line.First->isNot(tok::kw_namespace) &&
+               (Line.First->isNot(tok::kw_extern) ||
+                (Line.First->Next && !Line.First->Next->isStringLiteral()))) {
       // We don't merge short records.
       if (Line.First->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct))
         return 0;
@@ -1069,7 +1071,8 @@
     // Remove empty lines after "{".
     if (!Style.KeepEmptyLinesAtTheStartOfBlocks && PreviousLine &&
         PreviousLine->Last->is(tok::l_brace) &&
-        PreviousLine->First->isNot(tok::kw_namespace))
+        PreviousLine->First->isNot(tok::kw_namespace) &&
+        PreviousLine->First->isNot(tok::kw_extern))
       Newlines = 1;
 
     // Insert extra new line before access specifiers.
Index: unittests/Format/FormatTest.cpp
===================================================================
--- unittests/Format/FormatTest.cpp	(revision 221760)
+++ unittests/Format/FormatTest.cpp	(working copy)
@@ -187,7 +187,7 @@
                    "\n"
                    "};"));
 
-  // Don't remove empty lines at the start of namespaces.
+  // Don't remove empty lines at the start of namespaces or extern "C".
   EXPECT_EQ("namespace N {\n"
             "\n"
             "int i;\n"
@@ -197,6 +197,15 @@
                    "int    i;\n"
                    "}",
                    getGoogleStyle()));
+  EXPECT_EQ("extern \"C\" {\n"
+            "\n"
+            "int i;\n"
+            "}",
+            format("extern \"C\" {\n"
+                   "\n"
+                   "int    i;\n"
+                   "}",
+                   getGoogleStyle()));
 
   // Remove empty lines at the beginning and end of blocks.
   EXPECT_EQ("void f() {\n"
