Differential Revision: https://reviews.llvm.org/D50012
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338312
91177308-0d34-0410-b5e6-
96231b3b80d8
const char * OtherMsgBind = "OtherMessageSentM";
const char * AutoreleasePoolBind = "AutoreleasePoolM";
-class RunLoopAutoreleaseLeakChecker : public Checker<
- check::ASTCodeBody> {
+class RunLoopAutoreleaseLeakChecker : public Checker<check::ASTCodeBody> {
public:
void checkASTCodeBody(const Decl *D,
seenBeforeRec(const Stmt *Parent, const Stmt *A, const Stmt *B,
MemoizationMapTy &Memoization) {
for (const Stmt *C : Parent->children()) {
+ if (!C) continue;
+
if (C == A)
return true;
NSObject *object2 = [[NSObject alloc] init]; // no-warning, warning on the first one is enough.
(void) object;
(void) object2;
- [[NSRunLoop mainRunLoop] run];
+ [[NSRunLoop mainRunLoop] run];
}
}
}
}
+void no_crash_on_empty_children() {
+ @autoreleasepool {
+ for (;;) {}
+ NSObject *object = [[NSObject alloc] init]; // expected-warning{{Temporary objects allocated in the autorelease pool followed by the launch of main run loop may never get released; consider moving them to a separate autorelease pool}}
+ [[NSRunLoop mainRunLoop] run];
+ (void) object;
+ }
+}
+
#endif
#ifdef AP1