Граф коммитов

108 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 78d46242e3 Moved registration of basic path-sensitive checks from GRSimpleVals.cpp to GRExprEngineInternalChecks.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 16:21:24 +00:00
Ted Kremenek 1a80448f6f "currentHandler" is a nullary selector
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53763 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 18:14:26 +00:00
Ted Kremenek 2d1086cec0 Fix caching bug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53759 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 17:39:56 +00:00
Ted Kremenek 70a733e64e Add panic support for NSAssertionHandler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53758 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 17:24:20 +00:00
Ted Kremenek 35912db2b1 Update signature of EvalAssume.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53745 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 23:33:10 +00:00
Ted Kremenek 10161bfe1a isRetain() and isRelease() now only returns true if "Retain"/"Release" appears in the suffix of a function's name.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53621 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 17:43:41 +00:00
Ted Kremenek 37d785bf2b Support retain/release tracking for CoreGraphics (CGxxxRef) objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53617 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 16:50:12 +00:00
Ted Kremenek 4323a57627 Refactored most of the "Store" piece of ValueState into a Store type. The
current store implementation is now encapsulated by BasicStore.

These changes prompted some long due constification of ValueState. Much of the
diffs in this patch include adding "const" qualifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53423 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 22:03:41 +00:00
Ted Kremenek 070a825e26 Fix PR2519: correctly handle CFDictionaryCreate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53334 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 18:11:16 +00:00
Ted Kremenek e8fdc83ee4 Updated clients of ImmutableMap::SlimFind to use ImmutableMap::lookup instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53172 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 16:21:19 +00:00
Ted Kremenek 8c5633e947 Use conjured symbols for variables whose values are invalidated when
passed-by-reference to a function. This allows us to build up constraints for
their new values and restore some lost path-sensitivity. This addresses a few
false positives since in Adium.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53125 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 23:26:32 +00:00
Ted Kremenek c095997b85 Refactored some of the BugReporter interface so that data such as the ASTContext&, PathDiagnosticClient*, can be provided by an external source.
Split BugReporter into BugReporter and GRBugReporter so checkers not based on GRExprEngine can still use the BugReporter mechanism.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53048 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 21:24:01 +00:00
Ted Kremenek 179064eb83 Unlike NSWindow objects, NSPanel objects initially do not have self-ownership.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52963 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 17:21:27 +00:00
Ted Kremenek 80d753fd31 Temporarily treat "Autorelease" as "StopTracking". This is the original behavior.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52940 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 00:01:02 +00:00
Ted Kremenek e19f449661 Added "Autorelease" ArgEffect to better simulate "autorelease" messages. Right
now this does the same thing as "MayEscape", but more functionality will go in
here shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52904 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 16:57:41 +00:00
Ted Kremenek 553cf18cd4 CF ref checker:
Tracked objects now have their type information tracked with them.

Enhanced summaries for ObjC methods to include the type information of the receiver.

Used the enhanced summaries to support the idiom that NSWindow owns itself (it sends a release message to itself upon close).

Added some comments.

Did some cleanups with the checker logic using operator overloading (reduced redundant code which I was concerned about being the source of bugs).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52741 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 21:21:56 +00:00
Ted Kremenek ab592279f6 Remove unneeded method arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52668 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 03:56:45 +00:00
Ted Kremenek 53301ba984 Cache ObjC summaries by IdentifierInfo*, not by ObjCInterfaceDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 03:49:48 +00:00
Ted Kremenek 4f22a781a5 Added ObjCSummaryCache, a new summary cache object to cache summaries for Objective-C methods. Instead of mapping from Selectors -> Summaries, we will now map from (ObjCInterfaceDecl*,Selectors) -> Summaries. This will allow more nuanced summary generation. This patch just swaps in the new data structure; the rest of the code works as before by allowing the ObjCInterfaceDecl* to be null.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52653 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 23:30:29 +00:00
Ted Kremenek 1f180c3128 Rename summary methods for "instance methods" to "class methods" (the names got screwed up). No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52650 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 22:21:20 +00:00
Ted Kremenek a73447013c The CF retain/release checker now assumes that allocations do not fail. Eventually we will add a flag to the driver to enable allocation failures (documented as a FIXME).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 18:02:52 +00:00
Ted Kremenek 5549976193 This patch is motivated by numerous strict-aliasing warnings when compiling
clang as a Release build.

The big change is that all AST nodes (subclasses of Stmt) whose children are
Expr* store their children as Stmt* or arrays of Stmt*. This is to remove
strict-aliasing warnings when using StmtIterator. None of the interfaces of any
of the classes have changed (except those with arg_iterators, see below), as the
accessor methods introduce the needed casts (via cast<>). While this extra
casting may seem cumbersome, it actually adds some important sanity checks
throughout the codebase, as clients using StmtIterator can potentially overwrite
children that are expected to be Expr* with Stmt* (that aren't Expr*). The casts
provide extra sanity checks that are operational in debug builds to catch
invariant violations such as these.

For classes that have arg_iterators (e.g., CallExpr), the definition of
arg_iterator has been replaced. Instead of it being Expr**, it is an actual
class (called ExprIterator) that wraps a Stmt**, and provides the necessary
operators for iteration. The nice thing about this class is that it also uses
cast<> to type-checking, which introduces extra sanity checks throughout the
codebase that are useful for debugging.

A few of the CodeGen functions that use arg_iterator (especially from
OverloadExpr) have been modified to take begin and end iterators instead of a
base Expr** and the number of arguments. This matches more with the abstraction
of iteration. This still needs to be cleaned up a little bit, as clients expect
that ExprIterator is a RandomAccessIterator (which we may or may not wish to
allow for efficiency of representation).

This is a fairly large patch. It passes the tests (except CodeGen/bitfield.c,
which was already broken) on both a Debug and Release build, but it should
obviously be reviewed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52378 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 02:43:46 +00:00
Ted Kremenek 0327f77869 Teach the CF retain checker about "_init" methods. Fixes: <rdar://problem/5956379>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51872 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 17:14:13 +00:00
Ted Kremenek 1aa44c7c91 Prototyped support in the BugReporter to emit diagnostics of the form "p now aliases q".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51453 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 23:45:19 +00:00
Ted Kremenek 3eabf1c0e6 Expand retain/release checker to consider methods/function calls that cause a
tracked object to "escape": it's reference count might be incremented by the
called function, thus causing an object's lifetime to extend beyond when the
local reference count is decremented to 0.

This addresses: <rdar://problem/5933215>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51433 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 17:31:13 +00:00
Ted Kremenek 6ed9afc804 Cache leaks by the allocation site, not the leak location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51198 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-16 18:33:44 +00:00
Ted Kremenek 0e470a5326 Rename IsPointerType to LVal::IsLValType, and update CFRefCount::EvalSummary to use IsLValType when conjuring symbols for return values (this fixes a bug with an assertion firing in the analyzer when two qualified objective-c types were compared).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 23:45:33 +00:00
Ted Kremenek 299e8158d6 Added support for "drain".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50831 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 21:17:39 +00:00
Ted Kremenek 0fcbf8ef89 Expand the CF retain checker to allow the Create/Get rule to apply to any
function that returns a CFxxxRef, not just functions whose name begins with
CF.  This implements <rdar://problem/5917879>.

Added test case for this feature.

Updated calls to CStrInCStrNoCase to swap their arguments, per compatibility
with strcasestr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50829 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 20:06:41 +00:00
Ted Kremenek 0ae24fa129 Flip order of arguments to CStrInStrNoCase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50824 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 18:57:30 +00:00
Ted Kremenek 900a2d7f76 Use llvm::CStrInCStrNoCase instead of strcasestr, since the latter is not portable.
Correctly check if the result of CStrInCStrNoCase is NULL to generate summaries; before we were inverting the condition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 18:36:45 +00:00
Ted Kremenek f4250e24bc copy-paste: NS types are not typedefs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50817 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 17:35:41 +00:00
Ted Kremenek 05a7b0e109 Do not treat **instance** methods "copyWithZone:" and "mutableCopyWithZone:" from NSObject as allocators.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 05:34:45 +00:00
Ted Kremenek 84060dbbe5 Be less promiscuous with generating summaries for "new", "copy", "create".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50798 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 04:25:59 +00:00
Ted Kremenek a4b695a935 Added auto-summary generation for createXXX, copyXXX, newXXX methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50795 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 03:45:05 +00:00
Ted Kremenek a22cc2f6a6 Don't report leaks for autoreleased objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 23:07:13 +00:00
Ted Kremenek c839560d1b More comments.
"#if 0" out some assumptions when auto-generating method summaries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50772 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 21:26:51 +00:00
Ted Kremenek 432af5985a Experiment with not converting bug names to lower case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50753 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 18:11:36 +00:00
Ted Kremenek 1bffd7471b Generate "stop" summaries for selectors involving receivers whose type is not NSxxxx.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50721 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 15:44:25 +00:00
Ted Kremenek 84548b8352 Use strncmp correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 06:17:42 +00:00
Ted Kremenek aee9e57ced Make string comparison legible and remove buffer overrun introduced by typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50714 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 06:09:09 +00:00
Ted Kremenek 70f9d8652b String comparison cleanups.
Added test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 04:28:05 +00:00
Ted Kremenek 3fa0d299f9 Fix logic error in string processing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50710 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 04:21:38 +00:00
Ted Kremenek 0855dc31cd Remove assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50709 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 04:21:10 +00:00
Ted Kremenek b309525445 Use EvalSummary to process message expressions, thereby unifying the checker
logic for function calls and message expressions.

Use the following heuristic to infer "allocating" instance methods:

  [ClassName classWithXXX]  allocates an object
  
Update testcase to reflect this heuristic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50708 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 04:20:12 +00:00
Ted Kremenek 1499389d00 Added receiver effects to EvalSummary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50700 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 02:41:27 +00:00
Ted Kremenek 3c0cea3957 Expand summaries to include "Receiver" effects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 02:26:56 +00:00
Ted Kremenek b3c3c28c65 Added initialization code to generate initial set of ObjC method summaries (non-instance methods).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50690 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 00:38:54 +00:00
Ted Kremenek 9c32d08925 Added code to generate initial set of summaries for instance methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50689 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 00:30:21 +00:00
Ted Kremenek 46e49eeb30 Add summary generation for "initXXX" methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 23:55:01 +00:00