Chris Lattner
58fe03bc80
Fix rdar://6771034: don't warn on use of forward declared protocol in protocol
...
list of another protocol definition. This warning is very noisy and GCC doesn't
produce it so existing code doesn't expect it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 08:43:13 +00:00
Ted Kremenek
b3bf76fb24
Add analyzer support for objc_atomicCompareAndSwap()
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68849 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-11 00:54:13 +00:00
Ted Kremenek
1670e403c4
Implement analyzer support for OSCompareAndSwap. This required pushing "tagged"
...
ProgramPoints all the way through to GRCoreEngine.
NSString.m now fails with RegionStoreManager because of the void** cast.
Disabling use of region store for that test for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68845 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-11 00:11:10 +00:00
Ted Kremenek
3a0fd13778
Split failing test case from misc-ps.m to misc-ps-ranges.m (which tests
...
functionality specific to RangeConstraintManager).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68759 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 04:02:38 +00:00
Ted Kremenek
52e5602056
Fix: <rdar://problem/6776949> Branch condition evaluates to an uninitialized value (argc is guaranteed to be >= 1)
...
The analyzer now adds the precondition that the first argument of 'main' is > 0.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68757 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:59:50 +00:00
Ted Kremenek
b725232b46
Implement attribute "analyzer_noreturn" (<rdar://problem/6777003>). This allows
...
clients of the analyzer to designate custom assertion routines as "noreturn"
functions from the analyzer's perspective but not the compiler's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68746 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:01:14 +00:00
Ted Kremenek
fe630b943e
GRExprEngine: Don't try to reason about the size of 'void' for the return type
...
of messages sent to nil.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68683 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 05:45:56 +00:00
Daniel Dunbar
748dd20b55
Force triple for these tests.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 23:02:51 +00:00
Ted Kremenek
da9ae6088b
Enhance analyzer reasoning about sending messages to nil. A nil receiver returns 0 for scalars of size <= sizeof(void*).
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68629 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 18:51:08 +00:00
Ted Kremenek
899b3de7bc
New static analyzer check by Nikita Zhuk!
...
"The attached patch generates warnings of cases where an ObjC message is sent to
a nil object and the size of return type of that message is larger than the size
of void pointer. This may result in undefined return values as described in PR
2718. The patch also includes test cases."
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 03:07:17 +00:00
Ted Kremenek
e82e13ad4e
Add test case.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68505 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 05:33:18 +00:00
Ted Kremenek
99d0269390
retain/release checker: don't track NSPanel until we have better reasoning about
...
the subtle ownership issues of such objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68397 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 19:02:51 +00:00
Ted Kremenek
ef77d54a49
Add a few more analyzer test cases.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68326 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 17:25:00 +00:00
Ted Kremenek
b8adaf9053
Update expected warning in test case.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68276 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 02:52:13 +00:00
Ted Kremenek
b930d7adb7
Fix: <rdar://problem/6740387>. Sending nil to an object that returns a struct
...
should only be an error if that value is consumed. This fix was largely
accomplished by moving 'isConsumedExpr' back to ParentMap.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68195 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 06:52:48 +00:00
Ted Kremenek
28433ff063
Update test case.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 03:34:38 +00:00
Ted Kremenek
f3929daf7f
Add another uninitialized values test case illustrating that the CFG correctly
...
handles declarations with multiple variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68046 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 18:29:27 +00:00
Ted Kremenek
2a8d6b0852
Fix regression in pointer comparison with NULL (e.g., 0 != ptr). This fixes
...
<rdar://problem/6732151>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67954 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 19:59:33 +00:00
Daniel Dunbar
d7d5f0223b
Rename clang to clang-cc.
...
Tests and drivers updated, still need to shuffle dirs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 02:24:46 +00:00
Ted Kremenek
632d1ece27
A test case to test that -warn-dead-stores does not emit a warning for stores to variables marked with '#pragma unused'.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 22:30:58 +00:00
Ted Kremenek
68ac94a8d7
analyzer: Provide temporary workaround for false positive reported by
...
<rdar://problem/6704930> involving SimpleConstraintManager not reasoning well
about symbolic constraint values involving arithmetic operators.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67534 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 17:10:25 +00:00
Ted Kremenek
693de5d7fe
analyzer: Fix embarrassing regression in BasicStore when invalidating struct
...
values passed-by-reference to unknown functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67519 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 15:42:58 +00:00
Ted Kremenek
c505d4f156
Add test cases for PR 3820.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 19:50:58 +00:00
Ted Kremenek
72374594c5
Fix PR 3836 by eagerly assuming symbolic constraints returned by unary '!'.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67260 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 23:49:26 +00:00
Ted Kremenek
ec099f1f9d
Fix crash reported in <rdar://problem/6695527>. We now have
...
SVal::GetRValueSymbolVal do the checking if we can symbolicate a type instead of
having BasicStoreManager do it (which wasn't always doing the check
consistently). Having this check in SVal::GetRValueSymbolVal keeps the check in
one centralized place.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67245 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 22:10:22 +00:00
Zhongxing Xu
c57bc595cf
add test case.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67154 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 02:07:30 +00:00
Ted Kremenek
8be2a67620
Fix PR 3677 [retain checker]: custom 'allocWithZone' methods should be allowed
...
to return an owning pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 20:27:06 +00:00
Ted Kremenek
6ae8a36006
Add a hack in the analyzer to recover some path-sensitivity at branch
...
conditions. Currently the analyzer does not reason well about
promotions/truncations of symbolic values, so at branch conditions when we see:
if (condition)
and condition is something like a 'short' or 'char', essentially ignore the
promotion to 'int' so that we track constraints on the original symbolic value.
We only ignore the casts if the underlying type has the same or fewer bits as
the converted type.
This fixes:
<rdar://problem/6619921>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66899 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 16:32:54 +00:00
Ted Kremenek
610e81d6b7
Fix failure reported by Sebastian of test/Analysis/ptr-arith.c when the target
...
is 64-bit. I used his suggestion of doing a direct bitwidth/signedness
conversion of the 'offset' instead of just changing the sign. For more
information, see:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2009-March/004587.html
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 15:35:24 +00:00
Ted Kremenek
e6fbdf538b
Fix crash when using TypedViewRegions and ObjCQualifiedIdTypes (TypedViewRegion::getLValueType() was not implemented).
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 22:15:08 +00:00
Daniel Dunbar
50f4f46902
Add Diagnostic files for Frontend and move a couple errors over.
...
- Notably, clang now exits with an error if it can't find a
file. This flushed out a bug in the CGColorSpace.c test case. :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66789 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 10:14:16 +00:00
Zhongxing Xu
e8cba00b40
Add comments to test case.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66760 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 01:55:38 +00:00
Ted Kremenek
344d4c8726
Fix StmtIterator bug reported in PR 3780 where a VLA within a DeclGroup would
...
not be consulted for its size expression when operator* was called in the
StmtIterator (this resulted in an assertion failure).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66679 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 18:17:16 +00:00
Zhongxing Xu
3c4b37980a
This test case checks if we get the right rvalue type of a TypedViewRegion.
...
The ElementRegion's type depends on the array region's rvalue type. If it was
a pointer type, we would get a loc::SymbolVal for '*p'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66656 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 09:15:38 +00:00
Zhongxing Xu
2b1dc17919
Fix crash when LHS of pointer arithmetic is not ElementRegion.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 07:43:49 +00:00
Ted Kremenek
fa6228d614
Fix PR 3780: In one code path in BasicValueFactory::getValue() we would not
...
return an unsigned integer for a null pointer value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 02:52:39 +00:00
Ted Kremenek
7de20fe9aa
SimpleConstraintManager doesn't reason about bitwise-constraints on symbolic
...
values. Indicating this in 'canReasonAbout' allows GRExprEngine to recover
path-sensitivity in some cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 02:29:48 +00:00
Ted Kremenek
25d01badc5
retain/release checker: Allow allocations to fail by returning nil.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66487 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 22:46:49 +00:00
Ted Kremenek
cd57fcec52
Add test case for <rdar://problem/6659160>.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66483 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 22:28:18 +00:00
Ted Kremenek
5c42f9ba44
Fix another GRExprEngine::VisitCast regression: handle casts of void* to function pointers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66211 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 22:47:06 +00:00
Ted Kremenek
c530291ada
Fix regression in GRExprEngine::VisitCast: Do not wrap symbolic function pointers with TypedViewRegions.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66187 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 20:22:13 +00:00
Ted Kremenek
9f45d28d06
Update test case: objects stored to self.ivar are not tracked.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 18:15:02 +00:00
Ted Kremenek
f684d56828
Retrofit some basic tracking of ivars (for the current object) into BasicStore.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66166 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 18:08:28 +00:00
Ted Kremenek
f27893a1a1
Test case: When using RegionStore with the retain/release checker, stop tracking objects assigned to self's ivar.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66139 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 05:14:55 +00:00
Ted Kremenek
aad45e0e0f
Add test case for RegionStore's tracking of the ivars of 'self'.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66136 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 04:55:08 +00:00
Ted Kremenek
efcfcc0e27
GRExprEngine: Polish up handling of casting integer constants to pointers and back.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 02:42:32 +00:00
Ted Kremenek
3aa7ecd53f
For now, do not track NSWindow objects and it's subclasses.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66107 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 23:30:42 +00:00
Ted Kremenek
d104a09d30
Add prototype support for invalidating fields for structures passed-by-reference
...
to unknown functions. Most of this logic should be eventually moved to
RegionStore and be made lazy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 22:56:43 +00:00
Ted Kremenek
1f7de6630a
This test now passes using RegionStore.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65988 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 00:23:28 +00:00
Zhongxing Xu
e184b1e4e0
Add test case for pointer arithmetic.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03 00:28:42 +00:00