Ted Kremenek
404b132dc0
Move 'hasStackStorage()' and 'hasHeapStorage()' from MemRegionManager to MemRegion.
...
llvm-svn: 73973
2009-06-23 18:05:21 +00:00
Zhongxing Xu
7718ae4701
Move all factory methods from SVal to ValueManager. API cleanup!
...
llvm-svn: 73954
2009-06-23 09:02:15 +00:00
Ted Kremenek
fb87e30815
MemRegions:
...
- Embed a reference to MemRegionManager objects in MemSpaceRegion objects
- Use this embedded reference for MemRegion objects to access ASTContext objects without external help
- Use this access to ASTContext to simplify 'isBoundable' (no ASTContext& argument required)
llvm-svn: 73935
2009-06-23 00:46:41 +00:00
Ted Kremenek
095f1a9848
Move clients over from using GRStateManager::BindXXX and friends to
...
GRState->bindXXX and friends (and constify some arguments along the way).
llvm-svn: 73740
2009-06-18 23:58:37 +00:00
Ted Kremenek
f9906843b7
libAnalysis:
...
- Remove the 'isFeasible' flag from all uses of 'Assume'.
- Remove the 'Assume' methods from GRStateManager. Now the only way to
create a new GRState with an assumption is to use the new 'assume' methods
in GRState.
llvm-svn: 73731
2009-06-18 22:57:13 +00:00
Douglas Gregor
78bd61f661
Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.
...
llvm-svn: 73702
2009-06-18 16:11:24 +00:00
Ted Kremenek
d93c6e3fd6
Remove more dependencies on GRStateRef. As a consequence, we can now
...
pretty-print a GRState object anywhere it is referenced (instead of
needing a GRStateRef of a GRStateManager handy).
llvm-svn: 73669
2009-06-18 01:23:53 +00:00
Ted Kremenek
89a303caac
Remove another dependency on GRStateRef.
...
llvm-svn: 73667
2009-06-18 00:49:02 +00:00
Ted Kremenek
96aa146d90
Fix: <rdar://problem/6945561> -[CIContext createCGLayerWithSize:info:] misinterpreted by clang scan-build
...
llvm-svn: 73415
2009-06-15 20:58:58 +00:00
Ted Kremenek
3092e9c5c2
Fix: <rdar://problem/6961230> add knowledge of IOKit functions to retain/release checker
...
llvm-svn: 73411
2009-06-15 20:36:07 +00:00
Ted Kremenek
ea675cf6a3
Add summary lookup for IOServiceGetMatchingService.
...
Convert tabs to spaces.
llvm-svn: 73198
2009-06-11 18:17:24 +00:00
Ted Kremenek
a74ead4103
Refactor some function name -> summary lookup using a switch statement.
...
llvm-svn: 73197
2009-06-11 18:10:48 +00:00
Ted Kremenek
a03705c82d
Fix:
...
<rdar://problem/6948053> False positive: object substitution during -init* methods warns about returning +0 when using -fobjc-gc-only
llvm-svn: 72971
2009-06-05 23:18:01 +00:00
Ted Kremenek
ea1c221334
Enhance attribute cf_returns_retained to also work (in the analyzer)
...
for non-Objctive-C pointer types. This implicitly documents that the
return type is a CF object reference.
llvm-svn: 72968
2009-06-05 23:00:33 +00:00
Ted Kremenek
1036912118
Add special cases to retain checker for 'create' methods in QCView, QCRenderer, and CIContext (Apple APIs).
...
This fixes:
<rdar://problem/6902710> clang: false positives w/QC and CoreImage methods.
llvm-svn: 72187
2009-05-20 22:39:57 +00:00
Ted Kremenek
501ba0365a
Fix PR 4230: Don't flag leaks of NSAutoreleasePools until we know that we aren' at the top-most scope of autorelease pools.
...
llvm-svn: 72065
2009-05-18 23:14:34 +00:00
Ted Kremenek
e4302ee3bb
Fix: <rdar://problem/6893565> False positive: don't flag leaks for return types that cannot be determined to be CF types
...
llvm-svn: 71921
2009-05-16 01:38:01 +00:00
Ted Kremenek
3281977dbb
Fix crash when deriving the enclosing summary of a method whose first selector slot has a null IdentifierInfo*. This happens when analyzing Growl.
...
llvm-svn: 71857
2009-05-15 15:49:00 +00:00
Ted Kremenek
4785e41c12
Remove extra whitespace character in string literal. Purely cosmetic.
...
llvm-svn: 71847
2009-05-15 06:02:08 +00:00
Ted Kremenek
f9fa3cb78a
Fix <rdar://problem/6859457> [NSData dataWithBytesNoCopy] does not return a retained object.
...
llvm-svn: 71797
2009-05-14 21:29:16 +00:00
Ted Kremenek
5801f65a52
Fix crasher reported in PR 4209 caused by an invalid summary
...
generation when EvalObjCMessageExpr() did not resolve the
ObjCInterfaceDecl* for a receiver when the receiver's symbolic value
wasn't being explicitly tracked.
llvm-svn: 71685
2009-05-13 18:16:01 +00:00
Ted Kremenek
051a03d698
Fix crasher in CFRefCount.cpp reported by Nikita Zhuk due to recently added autorelease tracking.
...
llvm-svn: 71647
2009-05-13 07:12:33 +00:00
Ted Kremenek
1272f706ca
Fix: <rdar://problem/6320065> false positive - init method returns an object owned by caller
...
Now 'init' methods are treated by the retain/release checker as
claiming their receiver and allocating a new object.
llvm-svn: 71579
2009-05-12 20:06:54 +00:00
Zhongxing Xu
08a2ede018
Add logic for invalidating array region to CFRefCount.cpp. When invalidating
...
array region, set its default value to conjured symbol. When retrieving its
element, create new region value symbol for the element.
Also fix some 80 columns violations.
llvm-svn: 71548
2009-05-12 10:10:00 +00:00
Ted Kremenek
95d181936a
Fix <rdar://problem/6877235> Classes typedef-ed to CF objects should get the same treatment as CF objects
...
This was accomplished by having 'isTypeRef' recursively walk the typedef stack.
llvm-svn: 71538
2009-05-12 04:53:03 +00:00
Ted Kremenek
97f75f8bda
When stripping element regions for invalidating region values, treat FieldRegions and ObjCIvarRegions as "base" regions in addition to VarRegions.
...
llvm-svn: 71488
2009-05-11 22:55:17 +00:00
Ted Kremenek
d0e3ab2196
Fix regression reported in <rdar://problem/6866843>. The analyzer should extend the lifetime of an object stored to a container.
...
llvm-svn: 71452
2009-05-11 18:30:24 +00:00
Ted Kremenek
dc7853cd98
Fix a bug found by Thomas Clement where 'return [[[NSString alloc] init] autorelease]' would emit a false 'too many overreleases' error.
...
llvm-svn: 71432
2009-05-11 15:26:06 +00:00
Zhongxing Xu
52091db11f
TypedRegion is a too general assumption. Usually we only want to invalidate
...
the VarRegion as a super region of an ElementRegion.
llvm-svn: 71431
2009-05-11 14:28:14 +00:00
Ted Kremenek
1f8e4346fa
Add special warning about returning a retained object where a GC'ed object is expected.
...
llvm-svn: 71397
2009-05-10 16:52:15 +00:00
Ted Kremenek
dee56e37fc
retain/release checker: Flag a warning for non-owned objects returned
...
where an owned one is expected. Also add preliminary checking for
returning a positive retain count object in GC mode where an owned GC
object is expected.
llvm-svn: 71388
2009-05-10 06:25:57 +00:00
Ted Kremenek
3978f7972d
analyzer:
...
- Improve -autorelease diagnostics.
- Improve VLA diagnostics.
- Use "short description" for bug when outputting to TextDiagnostics
llvm-svn: 71383
2009-05-10 05:11:21 +00:00
Zhongxing Xu
34d04b3ca9
As discussed with Ted, rename TypedRegion::getObjectType() to
...
TypedRegion::getValueType().
llvm-svn: 71321
2009-05-09 03:57:34 +00:00
Ted Kremenek
c2de72776c
Add back analyzer support for ns_returns_retained and cf_returns_retained.
...
llvm-svn: 71309
2009-05-09 02:58:13 +00:00
Ted Kremenek
2d0ff62a0d
It lives! The retain/release checker now tracks objects that are sent
...
'autorelease'.
llvm-svn: 71307
2009-05-09 01:50:57 +00:00
Zhongxing Xu
8038f7b30f
rename: MemRegion:
...
RValueType => ObjectType
LValueType => LocationType
No functionality change.
llvm-svn: 71304
2009-05-09 00:50:33 +00:00
Ted Kremenek
9ec08aa3f7
More hacking on autorelease errors. We now can emit basic errors (disabled for
...
now until ready).
llvm-svn: 71303
2009-05-09 00:44:07 +00:00
Ted Kremenek
d35272f96b
Put most of the boilerplate logic in place for reporting autorelease errors.
...
llvm-svn: 71301
2009-05-09 00:10:05 +00:00
Ted Kremenek
8c8fb488e6
retain/release checker: Add stub for HandleAutoreleaseCounts.
...
llvm-svn: 71290
2009-05-08 23:32:51 +00:00
Ted Kremenek
884a8996c5
retain/release checker: Refactor error-reporting code in EvalDeadSymbols and
...
EvalEndPath. This sets the stage for handling autorelease counts.
llvm-svn: 71283
2009-05-08 23:09:42 +00:00
Ted Kremenek
3a0516b25a
retain checker: Track the number of times a tracked object is sent
...
'autorelease'. This isn't used yet to flag errors.
llvm-svn: 71244
2009-05-08 20:01:42 +00:00
Ted Kremenek
062c14ba24
Remove experimental ownership attributes from Clang.
...
llvm-svn: 71216
2009-05-08 15:19:25 +00:00
Ted Kremenek
9157fbb6a6
Minor code cleanup in retain/release checker in preparation for some
...
other changes. Instead of repeatedly checking for GC mode when
getting the return effect, just do this computation once.
llvm-svn: 71193
2009-05-07 23:40:42 +00:00
Ted Kremenek
bb8d546208
Refactor BugReporter interface to have a new 'BugReporterContext' and
...
'BugReporterVisitor'. This simplifies callbacks from BugReporter to BugReports
(via VisitNode). It also lays the foundation for arbitrary visitor "call backs"
that can be registered to a BugReporterContext as a PathDiagnostic is
constructed. These call backs can help operate as separate "experts" that can
work on constructed pieces of a PathDiagnostic for which they possess special
knowledge.
llvm-svn: 71121
2009-05-06 21:39:49 +00:00
Ted Kremenek
0626df4eeb
Fix analyzer regression reported in PR 4164:
...
- Update the old StoreManager::CastRegion to strip off 'ElementRegions' when
casting to void* (Zhongxing: please validate)
- Pass-by-reference argument invalidation logic in CFRefCount.cpp:
- Strip ElementRegions when the ElementRegion is just a 'raw data' view
on top of the underlying typed region.
llvm-svn: 71094
2009-05-06 18:19:24 +00:00
Ted Kremenek
213ff5a98e
Implement attribute 'ns_autorelease'.
...
llvm-svn: 70990
2009-05-05 18:44:20 +00:00
Ted Kremenek
94c464ef22
Implement attribute 'cf_returns_owned' (mirrors 'ns_returns_owned').
...
llvm-svn: 70952
2009-05-05 00:46:09 +00:00
Ted Kremenek
6bdfcf47ad
Remove experimental attribute 'ns_ownership_make_collectable.'
...
llvm-svn: 70940
2009-05-04 23:46:06 +00:00
Ted Kremenek
0836a19931
Rename attributes 'objc_ownership...' to 'ns_ownership...'.
...
llvm-svn: 70897
2009-05-04 19:10:19 +00:00
Ted Kremenek
5dbfa3fadd
Rename attributes:
...
'objc_ownership_cfretain' -> 'cf_ownership_retain'
'objc_ownership_cfrelease' -> 'cf_ownership_release'
Motivation: Core Foundation objects can be used in isolation from Objective-C,
and this forces users to reason about the separate semantics of CF objects. More
Sema support pending.
llvm-svn: 70884
2009-05-04 17:29:57 +00:00