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
Ted Kremenek
789deacdad
Make CF retain diagnostics more succinct.
...
In a leak's "name", indicate GC or non-GC bugs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50680 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 23:16:31 +00:00
Ted Kremenek
d3dbcf4be7
Initial work on refactoring the CFRefCount checker so that it is more
...
generic and handles reference counts for NSObjects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 22:11:16 +00:00
Ted Kremenek
e28565b994
Improve leak diagnostics to not report a leak on the same line where
...
the object was last used. This can be confusing to users.
For example:
// 'y' is leaked
x = foo(y);
instead:
x = foo(y);
// 'y' is leaked
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50661 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 18:50:19 +00:00
Ted Kremenek
ce48e00a35
Improved leak diagnostics.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50657 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 17:53:17 +00:00
Ted Kremenek
86ad3bcfc9
Minor refactorings/cleanups in CF retain checker and added support for NSMakeCollectable.
...
Added test case for NSMakeCollectable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50653 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 16:51:50 +00:00
Ted Kremenek
e92c1b26b3
Improved diagnostics for leaks: now we report which variable was leaked.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50588 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 20:53:50 +00:00
Ted Kremenek
9f7416138b
When running the reference count checker twice (GC and non-GC mode), only emit
...
basic warnings (dead stores, null dereferences) on the first pass.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50584 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 18:01:49 +00:00
Ted Kremenek
529a9bde67
Fix copy-paste bug.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50557 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 23:38:35 +00:00
Ted Kremenek
52a67df921
Remove no longer valid assertion.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50556 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 23:28:56 +00:00
Ted Kremenek
c9fa2f7bcc
Added line number diagnostics to indicate the allocation site of the leaked object.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 23:13:35 +00:00
Ted Kremenek
bb77e9b908
Do not highlight bogus ranges for leaks.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50549 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 22:50:36 +00:00
Ted Kremenek
9040c65860
Correctly invalidate reference count state when passing objects by reference in message expressions we don't understand.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 21:31:50 +00:00
Ted Kremenek
b83e02eeda
Renamed static method.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 18:31:44 +00:00
Ted Kremenek
31593ac278
When processing "release", "retain", and "autorelease" messages return the
...
lval passed as an argument.
Fix: Inverted diagnostic messages.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 04:02:04 +00:00
Ted Kremenek
5934cee407
Added support for "autorelease" message in CF ref. count checker.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50512 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 02:18:37 +00:00
Ted Kremenek
072192bcbb
added preliminary diagnostics in scan-build results to denote whether
...
a CF memory leak occurred with GC enabled, etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 23:47:44 +00:00
Ted Kremenek
c0c3f5dbc9
Teach more of the static analyzer about ObjCQualifiedIdType.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 20:17:27 +00:00
Ted Kremenek
036dce063a
Teach the static analysis engine about ObjCQualifiedIdType.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50493 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 20:01:29 +00:00
Ted Kremenek
65c9165dad
Update typestate logic to support GC-mode.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50396 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 05:44:10 +00:00
Ted Kremenek
377e2306a6
Implement semantics of CFMakeCollectable for the CF-reference count checker.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50395 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 05:33:51 +00:00
Ted Kremenek
e5c30122ca
Provide the option to run the CF-retain checker in GC enabled mode.
...
The transfer functions for the checker don't do anything special yet in GC mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 05:13:59 +00:00
Ted Kremenek
910e999c19
Do a better job at computing dead symbols.
...
Implemented support for better localized leaks in the CF reference count checker.
Now leaks should be flagged close to where they occur.
This should implement the desired functionality in <rdar://problem/5879592>, although the diagnostics still need to be improved.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 01:25:15 +00:00
Ted Kremenek
652adc6c5d
Add preliminary support for flagging leaks around when they happen (doesn't work yet).
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50237 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 23:57:27 +00:00