Chris Lattner
198cb4df6e
Instead of counting totally diagnostics, split the count into a count
...
of errors and warnings. This allows us to emit something like this:
2 warnings and 1 error generated.
instead of:
3 diagnostics generated.
This also stops counting 'notes' because they are just follow-on information
about the previous diag, not a diagnostic in themselves.
llvm-svn: 100675
2010-04-07 18:47:42 +00:00
Ted Kremenek
6e95bfc6a5
Fix crash in StoreManager::CastRegion() when the base region is a type with 0 size.
...
llvm-svn: 100594
2010-04-07 00:46:49 +00:00
Ted Kremenek
f969841a1a
Teach MemRegion::getBaseRegion() about ObjCIvarRegions. We want to treat
...
them the same way as fields. This fixes a regression in RegionStore::RemoveDeadbindings()
that emerged from going to the cluster-based analysis.
llvm-svn: 100570
2010-04-06 22:06:03 +00:00
Zhongxing Xu
faa4905e0c
Always assume block-level expressions in the caller are alive when analyzing
...
the callee.
llvm-svn: 100429
2010-04-05 13:16:29 +00:00
Zhongxing Xu
640aad7667
Use the element type to compute the array size when the base region is a VarRegion.
...
Patch by Jordy Rose.
llvm-svn: 100099
2010-04-01 08:20:27 +00:00
Ted Kremenek
c3e1f2f9ba
Fix a bug (PR 6699) in RegionStore::RemoveDeadBindings() where
...
array values with a non-zero offset would get prematurely pruned from the store.
llvm-svn: 100067
2010-04-01 00:15:55 +00:00
Ted Kremenek
2d107f9d1d
RegionStore: specially handle loads from integer global variables declared 'const'.
...
Fixes a false positive reported in PR 6288.
llvm-svn: 99922
2010-03-30 20:31:04 +00:00
Ted Kremenek
4be6a75884
Change the analyzer to recognize (but ignore) assignments to isa. Fixes PR 6302.
...
llvm-svn: 99904
2010-03-30 18:24:54 +00:00
Fariborz Jahanian
97752f7c95
Improve diagnostics on incomplete implementation
...
of objc classes; including which methods
need be implemented and where they come from.
WIP.
llvm-svn: 99724
2010-03-27 19:02:17 +00:00
Ted Kremenek
0f250e4c5b
Fix NoReturnFunctionChecker to properly look at a function's type
...
when determining if it returns. Fixes <rdar://problem/7796563>.
llvm-svn: 99663
2010-03-26 22:57:13 +00:00
Ted Kremenek
bb6f5af4a4
Tweak null dereference diagnostics to give clearer diagnostics when
...
a null dereference results from a field access.
llvm-svn: 99236
2010-03-23 01:11:38 +00:00
Ted Kremenek
28ec56d7dd
Improve the diagnostics for the UndefinedAssignmentChecker when an
...
uninitialized value is used in the LHS of a compound assignment.
llvm-svn: 99221
2010-03-22 22:16:26 +00:00
Ted Kremenek
c517974e9e
Add test case for <rdar://problem/7770737>.
...
llvm-svn: 98979
2010-03-19 19:45:03 +00:00
Ted Kremenek
c342c9c001
Refactor argument checking in CallAndMessageChecker to be the same
...
for both CallExprs and ObjCMessageExprs.
llvm-svn: 98800
2010-03-18 03:22:29 +00:00
Ted Kremenek
9c05f4ef69
Detect pass-by-value arguments that are structs that contain
...
uninitialized data.
llvm-svn: 98796
2010-03-18 02:17:27 +00:00
Ted Kremenek
e174fda979
Tweak dead stores checker to not emit a warning when initialization
...
a scalar variable with a scalar parameter. This is a
form of defensive programming. If the variable is unused,
it will be caused by -Wunused-variable.
llvm-svn: 98795
2010-03-18 01:22:39 +00:00
Zhongxing Xu
1bb6a1a593
Add use-after-free check to MallocChecker.
...
llvm-svn: 98136
2010-03-10 04:58:55 +00:00
Ted Kremenek
575398e29b
When computing in AnalysisContext the variables referenced
...
by a block, also look at the contained blocks.
llvm-svn: 98111
2010-03-10 00:18:11 +00:00
Zhongxing Xu
5cb8d9d40f
When profiling Environment, also profile with AnalysisContext*, bacause
...
we now may have identical states with different analysis context.
Set the right AnalysisContext in state when entering and leaving a callee.
With both of the above changes, we can pass the test case.
llvm-svn: 97724
2010-03-04 09:04:52 +00:00
Zhongxing Xu
6b11b4e050
Add comments to test case.
...
llvm-svn: 97619
2010-03-03 01:02:48 +00:00
Zhongxing Xu
d497e126cb
Register all parameters even if they didn't occur in the function body.
...
We may query their liveness because they are added to store when passing
argument values.
llvm-svn: 97562
2010-03-02 10:08:30 +00:00
Zhongxing Xu
e334bb1a66
Add test case for inlining call analysis.
...
llvm-svn: 97300
2010-02-27 02:44:37 +00:00
Ted Kremenek
d98d22b9af
Enhance the unused ivar checker to not consider an ivar to be accidentally unused
...
when it is explicitly marked as unused via __attribute__((unused)).
llvm-svn: 97104
2010-02-25 03:26:55 +00:00
Ted Kremenek
8cf9eeb519
Remove test case dependancy on platform headers.
...
llvm-svn: 97088
2010-02-25 01:16:07 +00:00
Ted Kremenek
d55522f02e
Add UnixAPIChecker, a meta checker to include various precondition checks for calls
...
to various unix/posix functions, e.g. 'open()'.
As a first check, check that when 'open()' is passed 'O_CREAT' that it has
a third argument.
llvm-svn: 97086
2010-02-25 00:20:35 +00:00
Ted Kremenek
b4331a9908
Dead emit dead store warnings when assigning nil to an ObjC object
...
pointer (for defensive programming). This matches the behavior with
assigning NULL to a regular pointer. Fixes <rdar://problem/7631278>.
llvm-svn: 96985
2010-02-23 21:19:33 +00:00
Ted Kremenek
e3c26d8f7e
Add test case for <rdar://problem/7242010>, which appears to have been fixed
...
in the recent changes to RegionStore::InvalidateRegions(). Note that we
are still not yet modeling 'memcpy()' explicitly.
llvm-svn: 96902
2010-02-23 07:17:57 +00:00
Ted Kremenek
1fcc56c57a
Recognize attributes ns_returns_not_retained and cf_returns_not_retained
...
in the static analyzer.
llvm-svn: 96539
2010-02-18 00:06:12 +00:00
Ted Kremenek
3eac2454dc
Add test case showing that a recursive block that captures a block pointer that
...
isn't marked '__block' is bad.
llvm-svn: 96357
2010-02-16 16:55:10 +00:00
Ted Kremenek
228639746a
Add simpler checker to check if variables captured by a block are uninitialized.
...
llvm-svn: 96341
2010-02-16 08:33:59 +00:00
Zhongxing Xu
be36ecbb60
Fix pr6293. If ptr is NULL, no operation is preformed.
...
llvm-svn: 96154
2010-02-14 06:49:48 +00:00
Ted Kremenek
1a6672a3d4
Enhance RegionStore::InvalidateRegions() to correctly invalidate bindings
...
by scanning through the values of LazyCompoundVals.
llvm-svn: 96067
2010-02-13 01:52:33 +00:00
Ted Kremenek
499b4e3387
Fix lookup of fields from lazy bindings to check if the region is
...
NULL, not the store, to determine if a lookup succeeded. The store
can be null if it contained no bindings. This fixes a false positive
reported to me by a user of the analyzer.
llvm-svn: 95679
2010-02-09 19:11:53 +00:00
Zhongxing Xu
000a859f05
Add support for binding and retrieving VarRegions in flat store.
...
llvm-svn: 95529
2010-02-08 05:40:07 +00:00
Ted Kremenek
bdfcacbe8f
Also teach RegionStore::RetrieveVar() to handle 'static' pointers that are implicitly initialized to NULL.
...
llvm-svn: 95479
2010-02-06 04:04:46 +00:00
Ted Kremenek
30fe9ecac2
Fix regression in RegionStore (from BasicStore) where static variables were not treated as being implicitly initialized to 0 (and instead were getting symbolicated).
...
llvm-svn: 95478
2010-02-06 03:57:59 +00:00
Ted Kremenek
5abd69d946
Teach RegionStore::InvalidateRegions() to also invalidate static variables referenced by blocks.
...
llvm-svn: 95459
2010-02-06 00:30:00 +00:00
Ted Kremenek
94e6d98cae
Add test case showing the analyzer invalidates '__block' variables when the block is passed as an argument to an ObjC method.
...
llvm-svn: 95366
2010-02-05 06:10:46 +00:00
Ted Kremenek
2f2692f8ca
Rename -cc1 option '-checker-cfref' to '-analyzer-check-objc-mem'.
...
llvm-svn: 95348
2010-02-05 02:06:54 +00:00
Ted Kremenek
b6e400c87c
Rename -cc1 option '-warn-objc-missing-dealloc' to '-analyzer-check-objc-missing-dealloc'.
...
llvm-svn: 95347
2010-02-05 01:59:21 +00:00
Ted Kremenek
61b506aa8f
Rename -cc1 option '-warn-objc-methodsigs' to '-analyzer-check-objc-methodsigs'.
...
llvm-svn: 95346
2010-02-05 01:57:44 +00:00
Ted Kremenek
2d8ef71ae6
Rename -cc1 option '-warn-objc-unused-ivars' to '-analyzer-check-objc-unused-ivars'.
...
llvm-svn: 95345
2010-02-05 01:55:01 +00:00
Ted Kremenek
d519b83757
Rename -cc1 option '-warn-dead-stores' to '-analyzer-check-dead-stores'.
...
llvm-svn: 95343
2010-02-05 01:52:40 +00:00
Ted Kremenek
ec5b3d45c1
Rename -cc1 option '-warn-security-syntactic' to '-analyzer-check-security-syntactic'.
...
llvm-svn: 95342
2010-02-05 01:50:36 +00:00
Ted Kremenek
fc8dbdf3c7
Add assorted test cases from PR 4172.
...
llvm-svn: 95297
2010-02-04 07:25:56 +00:00
Ted Kremenek
49f878524c
Specially handle casts to 'void' in AdjustedReturnValueChecker.
...
llvm-svn: 95287
2010-02-04 04:18:55 +00:00
Ted Kremenek
1e3b95580c
static analyzer: handle casts of a function to a function pointer with
...
a different return type. While we don't emit any errors (yet), at
least we avoid cases where we might crash because of an assertion
failure later on (when the return type differs from what is expected).
llvm-svn: 95268
2010-02-04 00:47:48 +00:00
Ted Kremenek
d960564b76
Fix regression in RegionStore due to recent changes in
...
RegionStoreManager::InvalidateRegions() by adjusting the worklist to
iterate over BindingKeys instead of MemRegions. We also only need to
do the actual invalidation work on base regions, and for non-base
regions just blow away their bindings.
llvm-svn: 95200
2010-02-03 04:16:00 +00:00
Ted Kremenek
416b923786
Explicitly check for casts to double or complex types instead of possibly asserting in SValuator.
...
llvm-svn: 95128
2010-02-02 21:11:40 +00:00
Ted Kremenek
fab459fc95
Fix bug in GRExprEngine::VisitSizeOfAlignOfExpr() where we do not add
...
'Pred' to 'Dst' for cases we currently don't handle. This fixes
<rdar://problem/7593875>.
llvm-svn: 95048
2010-02-02 02:01:51 +00:00