Commit Graph

84 Commits

Author SHA1 Message Date
Ted Kremenek dd43aeee54 Fixed: <rdar://problem/5881148>
Problem:

In the recently refactored VisitDeref (which processes dereferences), we
were incorrectly skipping the node just generated for the subexpression
of the dereference.  This was a horrible regression.

llvm-svn: 50176
2008-04-23 20:12:28 +00:00
Ted Kremenek c79c0591d6 Added lval type (and tracking) for StringLiterals.
llvm-svn: 50109
2008-04-22 21:39:21 +00:00
Ted Kremenek 31484b2477 Generalize caching mechanism for bugs reports. Now individual BugTypes
can decide the policy on how to cache related bugs.  This allows us to
properly to handle warning about multiple leaks in the same location in the
ref count checker (not yet done).

llvm-svn: 49918
2008-04-18 20:54:29 +00:00
Ted Kremenek 4d83728a57 Added "GetErrorNodes()" to BugType so that -trim-egraph can recognize errors
from registered BugTypes.  This helps with debugging.

Add detection of NULL values in ref count checker; this suppresses false positives.

llvm-svn: 49912
2008-04-18 19:23:43 +00:00
Ted Kremenek d004c418b6 Fixed bug in GREndPathNodeBuilder: only return a node if it wasn't in the node cache.
llvm-svn: 49907
2008-04-18 16:30:14 +00:00
Ted Kremenek f03e07c34d More grammar fixes.
llvm-svn: 49895
2008-04-18 05:32:44 +00:00
Ted Kremenek ca8892b456 Fix plurality debacle.
llvm-svn: 49894
2008-04-18 05:13:26 +00:00
Ted Kremenek 40d601f958 Added path diagnostics for reference counts.
llvm-svn: 49892
2008-04-18 04:55:01 +00:00
Ted Kremenek 396f43620f BugReport::VisitNode now takes BugReporter& instead of ASTContext&.
Shuffled around code in CFRefCount to better pair classes with implementation,
and started adding subclasses of RangedBugReport to handle better diagnostics
for reference count bugs.

llvm-svn: 49889
2008-04-18 03:39:05 +00:00
Ted Kremenek cffe635699 Simplified internal logic of BugReporter, consolidating EmitWarning and
EmitPathWarning into one method.  We now properly handle emitting warnings
without a PathDiagnosticClient when the warning does not involve a particular
statement.

llvm-svn: 49884
2008-04-18 01:56:37 +00:00
Ted Kremenek cc0951bde1 Hook up reporting reference count memory leaks to the BugReporter mechanism.
llvm-svn: 49879
2008-04-17 23:43:50 +00:00
Ted Kremenek a506fec90a Added transfer function support for ReturnStmt to support detecting leaks
involving objects that are returned but have an excessive reference count.

llvm-svn: 49861
2008-04-17 18:12:53 +00:00
Ted Kremenek cbf4c6134e CF ref. count checker: Register memory leaks at the end of a path.
llvm-svn: 49824
2008-04-16 22:32:20 +00:00
Ted Kremenek 7145489c37 Small tweaks to EvalStore: pass an "RVal" instead of "LVal" for the TargetLV to
represent possible stores to "Unknown."

llvm-svn: 49811
2008-04-16 20:40:59 +00:00
Ted Kremenek 8cb96e92a1 Implemented toll-free bridging support for CF Reference count checker.
llvm-svn: 49771
2008-04-16 04:28:53 +00:00
Ted Kremenek 748c7ce4ba Added initial boilerplate to support toll-free bridging in the ref-count checker.
llvm-svn: 49756
2008-04-15 23:44:31 +00:00
Ted Kremenek 12e721a728 Treat calls to unresolved functions in the CF-ref count checker as calls
to functions with NULL summaries.

llvm-svn: 49660
2008-04-14 17:45:13 +00:00
Ted Kremenek 7e15130dc9 Hooked up the dead-store checker to the BugReporter interface. Now dead-store
warnings are emitted as part of the warnings registered by GRSimpleVals.

llvm-svn: 49658
2008-04-14 17:39:48 +00:00
Ted Kremenek 8784a7c006 Add some boilerplate to report memory leaks at the end of an analyzed function.
Still need some boilerplate in BugReporter to report bugs at the end
of a function (not associated with a particular statement).

llvm-svn: 49564
2008-04-11 22:25:11 +00:00
Ted Kremenek 0a86fdb1ff Added FIXME
llvm-svn: 49558
2008-04-11 20:51:02 +00:00
Ted Kremenek 831f327568 Fix regression introduced by my last commit.
llvm-svn: 49556
2008-04-11 20:23:24 +00:00
Ted Kremenek a7c44113bc Changed behavior of how we handle "NULL" summaries: just call
GRSimpleVals::EvalCal(), and don't change reference counts.

Remove "getDoNothingSummary()", as a NULL summary does the same thing.

Added temporary hack for the "Get" rule for objects that return a pointer type:
treat them as non-owned CF objects.

Added test case to detect the release of a non-owned object.

llvm-svn: 49555
2008-04-11 20:11:19 +00:00
Ted Kremenek 988990f842 Use RangedBugReport to report better ranges for reference count errors.
llvm-svn: 49552
2008-04-11 18:40:51 +00:00
Ted Kremenek 4b77209694 Fixed some logic errors in the CF ref count checker; we now can detect simple
use-after-release errors.  Added test case.

llvm-svn: 49509
2008-04-10 23:44:06 +00:00
Ted Kremenek 3c03d52d6e Simplify CF ref. count checker state machine.
llvm-svn: 49505
2008-04-10 23:09:18 +00:00
Ted Kremenek 22bd628056 Fix some bonehead bugs in summary generation in CFRefCount.
llvm-svn: 49503
2008-04-10 22:58:08 +00:00
Ted Kremenek 4a78c3ae11 Refactored all logic to run the GRSimpleVals and CFRef checker into a common
code path in the clang driver.

Renamed options --grsimple to -checker-simple and -check-cfref to -checker-cfref.

llvm-svn: 49500
2008-04-10 22:16:52 +00:00
Ted Kremenek ea1bc3bec6 CFRefCount analysis now properly calls "EmitWarnings" after analyzing a function.
llvm-svn: 49488
2008-04-10 16:21:09 +00:00
Ted Kremenek c8bef6a076 Hooked up initial reference-count checks to the BugReporter interface.
llvm-svn: 49455
2008-04-09 23:49:11 +00:00
Ted Kremenek 7acc3a36ef Major refactoring/cleanup of GRExprEngine, ExplodedGraph, and BugReporter.
Bugs are now reported using a combination of "BugType" (previously
BugDescription) and Bug "BugReport" objects, which are fed to BugReporter (which
generates PathDiagnostics). This provides a far more modular way of registering
bug types and plugging in diagnostics.

GRExprEngine now owns its copy of GRCoreEngine, and is not owned by the
ExplodedGraph.

ExplodedGraph is no longer templated on the "checker", but instead on the state
contained in the nodes.

llvm-svn: 49453
2008-04-09 21:41:14 +00:00
Ted Kremenek ce8e881dc3 Added some boilerplate for emitting warnings from the CF-reference count checker.
llvm-svn: 49414
2008-04-09 01:10:13 +00:00
Ted Kremenek c27815ca82 Inlined clang/Analysis/Analyses/GRSimpleVals.h into LocalCheckers.h and removed
GRSimpleVals.h

Added a PathDiagnosticClient option to the driver functions for the
CFRefCountChecker and the GRSimpleVals analysis. Both analyses now accept a "-o"
argument from the driver that specifies where HTML reports should be dumped.

llvm-svn: 48989
2008-03-31 18:26:32 +00:00
Ted Kremenek 181f72369f Rename "Nodify" to "MakeNode"
llvm-svn: 48659
2008-03-21 21:30:14 +00:00
Chris Lattner 7a51313d8a Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it.  This follows the main
llvm tree, and allows the libraries to be built in parallel.  The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in.  This speeds
up parallel builds, particularly incremental ones.

llvm-svn: 48402
2008-03-15 23:59:48 +00:00