Initial work on additional memory collection for ObjC AST objects.  We now
have Destroy methods of ObjcMethodDecl and ObjCInterfaceDecl which recursively
destroy their owned Decls and Stmts.  There are a few cases where it is not
clear what to do (FIXMEs included in the patch).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52050 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 1745074..baf2667 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -224,7 +224,7 @@
 ///
 void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl,
                                         tok::ObjCKeywordKind contextKey) {
-  llvm::SmallVector<DeclTy*, 32>  allMethods;
+  llvm::SmallVector<DeclTy*, 32> allMethods;
   llvm::SmallVector<DeclTy*, 16> allProperties;
   tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword;
   SourceLocation AtEndLoc;
@@ -314,8 +314,11 @@
     }
   }
   /// Insert collected methods declarations into the @interface object.
-  Actions.ActOnAtEnd(AtEndLoc, interfaceDecl, &allMethods[0], allMethods.size(), 
-                     &allProperties[0], allProperties.size());
+  Actions.ActOnAtEnd(AtEndLoc, interfaceDecl,
+                     allMethods.empty() ? 0 : &allMethods[0],
+                     allMethods.size(), 
+                     allProperties.empty() ? 0 : &allProperties[0],
+                     allProperties.size());
 }
 
 ///   Parse property attribute declarations.