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

289 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 7faca82163 retain checker: RetainSummaryManager now has a 'DefaultSummary' object
which is returned instead of a null pointer.  This helps centralize
the logic concerning "default effects".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70826 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 04:57:00 +00:00
Ted Kremenek 22fe248abd retain checker: Don't bother using a FoldingSet to unique summaries.
We never compare summaries by their pointers, and we create only a
handful of them when analyzing a given function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70824 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 04:30:18 +00:00
Ted Kremenek 92511433cc Fix: <rdar://problem/6850275> CF objects returned from methods with "new" or "copy" in their name should be treated as owned
For methods that follow the "fundamental rule" and return Core
Foundation objects, treat those objects as owned by the caller.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70665 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 06:08:32 +00:00
Ted Kremenek b77449cead Convert ArgEffects from an std::vector to an ImmutableMap. This will make it much easier to clean up the summary generation logic with annotations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70660 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 05:20:50 +00:00
Ted Kremenek eff4b3c5cc Rename isTrackedObjectType() -> isTrackedObjCObjectType().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 04:42:10 +00:00
Ted Kremenek dd924e256e retain/release checker: Enhance leak description to say that the bug
occurs in GC mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-02 19:05:19 +00:00
Ted Kremenek 2cd1293ad3 retain/release checker: Hook up attributes 'objc_ownership_retain' and
'objc_ownership_release' to the effects on receivers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70507 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 20:00:31 +00:00
Ted Kremenek 9f246b6bca Handle case in EvalReturn where we cache out in the ExplodedGraph.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70475 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 05:51:50 +00:00
Ted Kremenek 76a50e3258 retain/release checker: Use the ObjCMethodDecl in the @implementation if no
matching ObjCMethodDecl exists in the @interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70474 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 05:47:23 +00:00
Ted Kremenek 70a6576c9c retain/release checker: Resolve method decl in @interface after getting the
ObjCInterfaceDecl, not before.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 05:41:14 +00:00
Ted Kremenek a883355a6f retain/release checker: When determining whether an analyzed method can return
an owned object, consult its summary instead of inspecting the selector. This
picks up annotations, and is just more general.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70429 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 23:03:22 +00:00
Ted Kremenek 8987a02fa1 Format cleanup. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 22:25:52 +00:00
Ted Kremenek 298862dbcc Reformat long line. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70412 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 21:31:59 +00:00
Ted Kremenek c887d13b07 retain/release checker: Hoist code for bug reports above transfer function logic
(those diffs are just code moving) and move the logic for "return of owned
object" leak reporting to EvalReturnStmt.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70399 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 18:50:19 +00:00
Ted Kremenek 552333cfa9 Add version of getMethodSummary() that can be used to query the summary for the
method currently being analyzed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70388 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 17:17:48 +00:00
Ted Kremenek ce8a41d020 Rename getMethodSummary() -> getInstanceMethodSummary().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70387 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 17:09:14 +00:00
Ted Kremenek 8711c03dda retain/release checker: Refactor getMethodSummary() to not depend on ObjCMessageExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70369 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 05:04:30 +00:00
Zhongxing Xu f82af1e03a As discussed with Ted offline, re-apply r70293.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 02:30:09 +00:00
Ted Kremenek fcd7c6fc67 retain/release checker: Refactor the guts of getClassMethodSummary to not depend
on ObjCMessageExpr. This will enable us to use it elsewhere. This should not
change any functionality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 00:42:39 +00:00
Ted Kremenek bf20dbdec6 Implement ownership attribute 'objc_ownership_make_collectable'. This allows one
to add 'CFMakeCollectable' semantics to a method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 22:32:26 +00:00
Ted Kremenek b9dda75a0a Revert 70293.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70313 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 18:48:13 +00:00
Zhongxing Xu 6fd644a6ab Now we can remove the 'blast-through' code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 13:49:42 +00:00
Ted Kremenek c6a59e4bf2 Add two new checker-specific attributes: 'objc_ownership_release' and
'objc_ownership_cfrelease'. These are the 'release' equivalents of
'objc_ownership_retain' and 'objc_ownership_cfretain' respectively.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 19:36:56 +00:00
Ted Kremenek e798e7c5a1 Track objects in GC mode returned by 'alloc', 'new', etc. methods. These are
treated as "not owned" objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 19:14:45 +00:00
Ted Kremenek 4064de9598 Add new checker-specific attribute 'objc_ownership_cfretain'. This is the same
as 'objc_ownership_cfretain' except that the method acts like a CFRetain instead
of a [... retain] (important in GC modes). Checker support is wired up, but
currently only for Objective-C message expressions (not function calls).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70218 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:27:22 +00:00
Sebastian Redl d3a413d3b8 Implement function-try-blocks. However, there's a very subtle bug that I can't track down.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70155 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 20:35:05 +00:00
Ted Kremenek 4da0427a20 Hook up attribute 'objc_ownership_retain' to the analyzer. This attribute allows
users to specify that a method's argument is visibly retained (reference count
incremented).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70008 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 01:21:50 +00:00
Ted Kremenek 8650f088ce Hook up __attribute__((objc_ownership_returns)) to the retain/release checker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70002 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 23:32:32 +00:00
Ted Kremenek 8ee885bae5 Fix the same false positive reported in PR 2542 and <rdar://problem/6793409>
involving an NSAnimation object delegating its release to a delegate method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 21:56:17 +00:00
Ted Kremenek ff11cd148b Minor refactoring: pass selector to getCommonMethodSummary(). No functionality
change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 18:19:07 +00:00
Ted Kremenek 376d1e72c3 retain/release checker: more hacks to workaround false positives cause by
delegates. When a reference counted object is passed as to a 'void*' argument to
a method stop tracking the reference count.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69984 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 18:00:17 +00:00
Ted Kremenek 2e09bf6d02 Sentence case bug name.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69983 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 17:51:19 +00:00
Ted Kremenek de4d5339e0 retain/release checker:
- Fix summary lookup for class methods to now use the (optional)
  ObjCInterfaceDecl associated with a message expression. This removes a
  long-standing FIXME.
- Partial fix for <rdar://problem/6062730> by stop tracking objects that
  are passed to [NSObject performSelector].  These methods are often used
  for delegates, which the analyzer doesn't reason about well yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69982 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 17:50:11 +00:00
Ted Kremenek 250b1fa290 Refactor common logic in getMethodSummary() and getClassMethodSummary(). No
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69936 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 23:08:22 +00:00
Ted Kremenek 97d095f4e5 Further cleanups to isTrackedObjectType().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 22:11:07 +00:00
Ted Kremenek f9df1362f0 retain/release checker: Don't call isTrackedObject() with the canonical type.
This was preventing the checker from tracking return objects referenced by 'id'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 21:25:57 +00:00
Ted Kremenek 1f0186cf0c retain/release checker: For class methods, only treat return values that are
object references as tracked objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 20:02:30 +00:00
Ted Kremenek e87450e5a3 Per discussions with Ken Ferry and Paul Marks (<rdar://problem/6815234>) greatly
extend the number of objects tracked by the retain/release checker by assuming
that all class and instance methods should follow Cocoa object "getter" and
"alloc/new" conventions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69908 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 19:11:35 +00:00
Zhongxing Xu 369f447ede get a CodeTextRegion when visiting FunctionDecl reference.
get FunctionDecl with more general utility method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 05:24:46 +00:00
Douglas Gregor 7297134f12 FunctionDecl::getBody() is getting an ASTContext argument for use in
lazy PCH deserialization. Propagate that argument wherever it needs to
be. No functionality change, except that I've tightened up a few PCH
tests in preparation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 00:02:19 +00:00
Ted Kremenek 8d7f5481a0 - Move ownership of MemRegionManager into ValueManager.
- Pull SVal::GetConjuredSymbol() and friends into ValueManager. This greatly
simplifies the calling interface to clients.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 22:22:44 +00:00
Douglas Gregor 6ab3524f72 Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68726 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 21:40:53 +00:00
Ted Kremenek 044b6f0417 analyzer: Introduce a new class, ValueManager, that serves as an aggregate
"manager of symbolic values", wrapping BasicValueFactory, SymbolManager, and
MemRegionManager. While these individual managers nicely separate functionality
in the analyzer, constructing symbolic values can sometimes be cumbersome
because it requires using multiple managers at once. The goal of this class is
to create some factory methods to create SVals that require the use of these
different managers, thus (hopefully) simplifying the analyzer API for clients.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 16:13:17 +00:00
Zhongxing Xu 8944c49287 stop using loc::SymbolVal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68696 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 06:43:44 +00:00
Zhongxing Xu f97c070628 stop using loc::SymbolVal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68695 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 06:41:51 +00:00
Zhongxing Xu bd41db927a clean up code with new API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 06:35:30 +00:00
Zhongxing Xu 6782f75fd0 clean up code with new API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68693 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 06:32:20 +00:00
Zhongxing Xu fe1635bb27 Add a new method because sometimes the type of the conjured symbol is not the
type of the expression where we create the symbol.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68692 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 06:30:17 +00:00
Zhongxing Xu 9e82acb49d make a conjured symbol as the original code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68691 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 06:18:05 +00:00
Zhongxing Xu 51ae79044d clean up code with new API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68687 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 06:03:54 +00:00