[analyzer] Syntactic matcher for leaks associated with run loop and autoreleasepool
authorGeorge Karpenkov <ekarpenkov@apple.com>
Wed, 25 Jul 2018 01:27:15 +0000 (01:27 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Wed, 25 Jul 2018 01:27:15 +0000 (01:27 +0000)
commit7112483272b333f210cec6c21892b13094fdf26d
tree699abd420114458670e2a414aa05d54df2463473
parentfc501a9223e2e8ea8202fca06a58d6750f9a73a8
[analyzer] Syntactic matcher for leaks associated with run loop and autoreleasepool

A checker for detecting leaks resulting from allocating temporary
autoreleasing objects before starting the main run loop.

Checks for two antipatterns:

1. ObjCMessageExpr followed by [[NARunLoop mainRunLoop] run] in the same
autorelease pool.

2. ObjCMessageExpr followed by [[NARunLoop mainRunLoop] run] in no
autorelease pool.

Happens-before relationship is modeled purely syntactically.

rdar://39299145

Differential Revision: https://reviews.llvm.org/D49528

llvm-svn: 337876
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
clang/lib/StaticAnalyzer/Checkers/RunLoopAutoreleaseLeakChecker.cpp [new file with mode: 0644]
clang/test/Analysis/Checkers/RunLoopAutoreleaseLeakChecker.m [new file with mode: 0644]
clang/test/Analysis/Inputs/system-header-simulator-for-objc-dealloc.h