Deleted Added
full compact
RunLoopAutoreleaseLeakChecker.cpp (344779) RunLoopAutoreleaseLeakChecker.cpp (353358)
1//=- RunLoopAutoreleaseLeakChecker.cpp --------------------------*- C++ -*-==//
2//
1//=- RunLoopAutoreleaseLeakChecker.cpp --------------------------*- C++ -*-==//
2//
3// The LLVM Compiler Infrastructure
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4//
6//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
7//
8//
9//===----------------------------------------------------------------------===//
10//
11// A checker for detecting leaks resulting from allocating temporary
12// autoreleased objects before starting the main run loop.
13//
14// Checks for two antipatterns:
15// 1. ObjCMessageExpr followed by [[NSRunLoop mainRunLoop] run] in the same
16// autorelease pool.

--- 94 unchanged lines hidden (view full) ---

111 return;
112
113 PathDiagnosticLocation Location = PathDiagnosticLocation::createBegin(
114 ME, BR.getSourceManager(), ADC);
115 SourceRange Range = ME->getSourceRange();
116
117 BR.EmitBasicReport(ADC->getDecl(), Checker,
118 /*Name=*/"Memory leak inside autorelease pool",
8//===----------------------------------------------------------------------===//
9//
10// A checker for detecting leaks resulting from allocating temporary
11// autoreleased objects before starting the main run loop.
12//
13// Checks for two antipatterns:
14// 1. ObjCMessageExpr followed by [[NSRunLoop mainRunLoop] run] in the same
15// autorelease pool.

--- 94 unchanged lines hidden (view full) ---

110 return;
111
112 PathDiagnosticLocation Location = PathDiagnosticLocation::createBegin(
113 ME, BR.getSourceManager(), ADC);
114 SourceRange Range = ME->getSourceRange();
115
116 BR.EmitBasicReport(ADC->getDecl(), Checker,
117 /*Name=*/"Memory leak inside autorelease pool",
119 /*Category=*/"Memory",
118 /*BugCategory=*/"Memory",
120 /*Name=*/
121 (Twine("Temporary objects allocated in the") +
122 " autorelease pool " +
123 (HasAutoreleasePool ? "" : "of last resort ") +
124 "followed by the launch of " +
125 (RL ? "main run loop " : "xpc_main ") +
126 "may never get released; consider moving them to a "
127 "separate autorelease pool")

--- 70 unchanged lines hidden (view full) ---

198 BugReporter &BR) const {
199 checkTempObjectsInSamePool(D, AM, BR, this);
200 checkTempObjectsInNoPool(D, AM, BR, this);
201}
202
203void ento::registerRunLoopAutoreleaseLeakChecker(CheckerManager &mgr) {
204 mgr.registerChecker<RunLoopAutoreleaseLeakChecker>();
205}
119 /*Name=*/
120 (Twine("Temporary objects allocated in the") +
121 " autorelease pool " +
122 (HasAutoreleasePool ? "" : "of last resort ") +
123 "followed by the launch of " +
124 (RL ? "main run loop " : "xpc_main ") +
125 "may never get released; consider moving them to a "
126 "separate autorelease pool")

--- 70 unchanged lines hidden (view full) ---

197 BugReporter &BR) const {
198 checkTempObjectsInSamePool(D, AM, BR, this);
199 checkTempObjectsInNoPool(D, AM, BR, this);
200}
201
202void ento::registerRunLoopAutoreleaseLeakChecker(CheckerManager &mgr) {
203 mgr.registerChecker<RunLoopAutoreleaseLeakChecker>();
204}
205
206bool ento::shouldRegisterRunLoopAutoreleaseLeakChecker(const LangOptions &LO) {
207 return true;
208}