Fix leaking of LexedMethod objects created for caching objc method definitions tokens
for late parsing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145394 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 3cb2aaa..10c74ff 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1500,7 +1500,7 @@
// missing @implementation
Diag(atEnd.getBegin(), diag::err_expected_implementation);
- LateParsedObjCMethods.clear();
+ clearLateParsedObjCMethods();
ObjCImpDecl = 0;
return Actions.BuildDeclaratorGroup(
DeclsInGroup.data(), DeclsInGroup.size(), false);
@@ -1515,6 +1515,14 @@
return Actions.ConvertDeclToDeclGroup(ImpDecl);
}
+void Parser::clearLateParsedObjCMethods() {
+ for (LateParsedObjCMethodContainer::iterator
+ I = LateParsedObjCMethods.begin(),
+ E = LateParsedObjCMethods.end(); I != E; ++I)
+ delete *I;
+ LateParsedObjCMethods.clear();
+}
+
/// compatibility-alias-decl:
/// @compatibility_alias alias-name class-name ';'
///