Commit Graph

11 Commits

Author SHA1 Message Date
George Karpenkov d245644c76 [analyzer] Do not run visitors until the fixpoint, run only once.
In the current implementation, we run visitors until the fixed point is
reached.
That is, if a visitor adds another visitor, the currently processed path
is destroyed, all diagnostics is discarded, and it is regenerated again,
until it's no longer modified.
This pattern has a few negative implications:

 - This loop does not even guarantee to terminate.
   E.g. just imagine two visitors bouncing a diagnostics around.
 - Performance-wise, e.g. for sqlite3 all visitors are being re-run at
   least 10 times for some bugs.
   We have already seen a few reports where it leads to timeouts.
 - If we want to add more computationally intense visitors, this will
   become worse.
 - From architectural standpoint, the current layout requires copying
   visitors, which is conceptually wrong, and can be annoying (e.g. no
   unique_ptr on visitors allowed).

The proposed change is a much simpler architecture: the outer loop
processes nodes upwards, and whenever the visitor is added it only
processes current nodes and above, thus guaranteeing termination.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335666 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 21:12:08 +00:00
Mandeep Singh Grang 7fa6d053b1 [clang] Remove redundant return [NFC]
Reviewers: rsmith, sfantao, mcrosier

Reviewed By: mcrosier

Subscribers: jholewinski, cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318074 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-13 19:29:31 +00:00
David Blaikie eeb7838f3e Migrate PathDiagnosticPiece to std::shared_ptr
Simplifies and makes explicit the memory ownership model rather than
implicitly passing/acquiring ownership.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291143 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 17:26:53 +00:00
Devin Coughlin 153d45226d [analyzer] Fix capitalization in ObjCSuperDealloc checker diagnostic.
Change "use of 'self'..." to "Use of 'self'...". The convention is to
start diagnostics with a capital letter.

rdar://problem/28322494

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285759 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-01 22:16:39 +00:00
Benjamin Kramer e0bd794efa Move class into anonymous namespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04 14:18:52 +00:00
Devin Coughlin fbec52f071 [analyzer] Fix capitalization in ObjCSuperDeallocChecker diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262520 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 21:22:48 +00:00
Devin Coughlin b22bef46a5 [analyzer] Prune some incorrect \param doc comment annotations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261970 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 03:41:31 +00:00
Devin Coughlin c7025a6975 [analyzer] Shorten ObjcSuperDeallocChecker diagnostics.
Change "use of 'self' after it has been freed with call to [super dealloc]" to
"use of 'self' after it has been deallocated" and "use of instance variable
'_ivar' after the instance has been freed with call to [super dealloc]" to
"use of instance variable '_ivar' after 'self' has been deallocated".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261945 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 00:47:42 +00:00
Devin Coughlin a325236d5d [analyzer] Fix a memory error in r261935 caught by the Windows bots.
It was using a temporary StringRef after its underlying storage was freed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261944 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 00:23:41 +00:00
Devin Coughlin b6d0b32d8e [analyzer] Warn on use of 'self' after call to to [super dealloc].
Referring to 'self' after a call to [super dealloc] is a use-after-free in
Objective-C because NSObject's -dealloc frees the memory pointed to by self.
This patch extends the ObjCSuperDeallocChecker to catch this error.

rdar://problem/6953275

Differential Revision: http://reviews.llvm.org/D17528

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261935 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 23:36:52 +00:00
Devin Coughlin 2fcfab471c [analyzer] Detect duplicate [super dealloc] calls
Add an alpha path checker that warns about duplicate calls to [super dealloc].
This will form the foundation of a checker that will detect uses of
'self' after calling [super dealloc].

Part of rdar://problem/6953275.

Based on a patch by David Kilzer!

Differential Revision: http://reviews.llvm.org/D5238

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261545 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-22 17:56:24 +00:00