clang-format: Support ObjC's NS_ENUMs.

Before:
  typedef NS_ENUM(NSInteger, MyType) {
      /// Information about someDecentlyLongValue.
      someDecentlyLongValue,
      /// Information about anotherDecentlyLongValue.
      anotherDecentlyLongValue,
      /// Information about aThirdDecentlyLongValue.
      aThirdDecentlyLongValue};

After:
  typedef NS_ENUM(NSInteger, MyType) {
    /// Information about someDecentlyLongValue.
    someDecentlyLongValue,
    /// Information about anotherDecentlyLongValue.
    anotherDecentlyLongValue,
    /// Information about aThirdDecentlyLongValue.
    aThirdDecentlyLongValue
  };

llvm-svn: 200469
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index b56140e..ef55b68 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -668,6 +668,12 @@
     case tok::kw_enum:
       parseEnum();
       break;
+    case tok::kw_typedef:
+      nextToken();
+      // FIXME: Use the IdentifierTable instead.
+      if (FormatTok->TokenText == "NS_ENUM")
+        parseEnum();
+      break;
     case tok::kw_struct:
     case tok::kw_union:
     case tok::kw_class:
@@ -1129,7 +1135,10 @@
 }
 
 void UnwrappedLineParser::parseEnum() {
-  nextToken();
+  if (FormatTok->Tok.is(tok::kw_enum)) {
+    // Won't be 'enum' for NS_ENUMs.
+    nextToken();
+  }
   // Eat up enum class ...
   if (FormatTok->Tok.is(tok::kw_class) ||
       FormatTok->Tok.is(tok::kw_struct))