Ted Kremenek
02d6aca867
Tweak UndefBranchChecker to register the most nested "undefined" expression with bugreporter::registerTrackNullOrUndefValue instead of the condition itself.
...
llvm-svn: 89682
2009-11-23 18:12:03 +00:00
Fariborz Jahanian
0afc555196
Make 'SEL' pointer to a builtin type and not an
...
objective-c pointer type. This was a serious mishap and
luckily, Ted's test caught that (and patch fixes the test case).
llvm-svn: 89680
2009-11-23 18:04:25 +00:00
Ted Kremenek
d4dca6fde6
Cleanup title/description of "undefined branch" BugType and add some test cases for this check.
...
llvm-svn: 89679
2009-11-23 17:58:48 +00:00
Ted Kremenek
12b64959ce
Change CheckDeadStores to use Expr::isNullPointerConstant, which will correctly determine whether an expression is a null pointer constant.
...
Patch by Kovarththanan Rajaratnam!
llvm-svn: 89621
2009-11-22 20:26:21 +00:00
Fariborz Jahanian
252ba5fb6f
This patch implements objective-c's 'SEL' type as a built-in
...
type and fixes a long-standing code gen. crash reported in
at least two PRs and a radar. (radar 7405040 and pr5025).
There are couple of remaining issues that I would like for
Ted. and Doug to look at:
Ted, please look at failure in Analysis/MissingDealloc.m.
I have temporarily added an expected-warning to make the
test pass. This tests has a declaration of 'SEL' type which
may not co-exist with the new changes.
Doug, please look at a FIXME in PCHWriter.cpp/PCHReader.cpp.
I think the changes which I have ifdef'ed out are correct. They
need be considered for in a few Indexer/PCH test cases.
llvm-svn: 89561
2009-11-21 19:53:08 +00:00
Ted Kremenek
775d9c149d
Add RegionStore test case that shows that floating point values are also implicitly tracked for undefined values. (test case for <rdar://problem/6811085>).
...
llvm-svn: 89538
2009-11-21 02:52:12 +00:00
Ted Kremenek
f3febe4bdc
Add another test case to show the precision of RegionStore over
...
BasicStore. In this example, BasicStore would lose information about
the pointer in path after '*path++', causing the analyzer to falsely
flag a null dereference. This addresses <rdar://problem/7191542>.
llvm-svn: 89533
2009-11-21 02:17:47 +00:00
Ted Kremenek
caf2c51fad
Pull BadCallChecker int UndefinedArgChecker, and have UndefinedArgChecker also handled undefined receivers in message expressions.
...
llvm-svn: 89524
2009-11-21 01:25:37 +00:00
Ted Kremenek
f7adea43b4
More checker refactoring. Passing undefined values in a message expression is now handled by UndefinedArgChecker.
...
llvm-svn: 89519
2009-11-21 00:49:41 +00:00
Ted Kremenek
a4f7c180ae
Add simple static analyzer checker to check for sending 'release', 'retain', etc. directly to a class. Fixes <rdar://problem/7252064>.
...
llvm-svn: 89449
2009-11-20 05:27:05 +00:00
Ted Kremenek
c1f161c012
Unused ivar checker: ivars referenced by lexically nested functions should not be flagged as unused. Fixes <rdar://problem/7254495>.
...
llvm-svn: 89448
2009-11-20 04:31:57 +00:00
Ted Kremenek
a96d02c76b
Really fix test case.
...
llvm-svn: 89430
2009-11-20 01:20:12 +00:00
Ted Kremenek
4b412f51df
Fix test case.
...
llvm-svn: 89429
2009-11-20 01:19:22 +00:00
Ted Kremenek
dd2b2b23c8
Fix null dereference in NSAutoreleasePoolChecker when analyzing messages sent to blocks.
...
llvm-svn: 89413
2009-11-20 00:12:36 +00:00
Ted Kremenek
439a6d146c
Fix crash when using --analyzer-store=region when handling initializers with nested arrays/structs whose values are not explicitly specified. Fixes <rdar://problem/7403269>.
...
llvm-svn: 89384
2009-11-19 20:20:24 +00:00
Daniel Dunbar
484afa2d3b
Switch -f{builtin,math-errno,rtti} and -analyzer-purge-dead to -...no... variants instead of using llvm: 🆑 :init(true) arguments.
...
llvm-svn: 89315
2009-11-19 04:55:23 +00:00
Daniel Dunbar
f6e32e4abe
Drop unnecessary #include.
...
llvm-svn: 89154
2009-11-17 22:25:16 +00:00
Daniel Dunbar
fba0b44d35
Use -fblocks and -fobjc-nonfragile-abi when that is what is being tested, instead of forcing the triple.
...
llvm-svn: 89072
2009-11-17 09:04:12 +00:00
Zhongxing Xu
23baa01af4
Add PreVisitReturn to Malloc checker. Now we can recognize returned memory
...
block.
llvm-svn: 89071
2009-11-17 08:58:18 +00:00
Daniel Dunbar
feedba68b5
Don't #include <stdio.h> when tests don't need it, or use clang instead of clang-cc when they do.
...
llvm-svn: 89070
2009-11-17 08:57:36 +00:00
Zhongxing Xu
4668c7ed1c
Add EvalEndPath interface to Checker. Now we can check memory leaked at the
...
end of the path. Need to unify interfaces.
llvm-svn: 89063
2009-11-17 07:54:15 +00:00
Ted Kremenek
99b944c037
Add newline at the end of the file.
...
llvm-svn: 89052
2009-11-17 06:34:24 +00:00
Ted Kremenek
5b2592ed65
Add test to verify that the analyzer plist output is what we expect.
...
llvm-svn: 89029
2009-11-17 02:31:39 +00:00
Fariborz Jahanian
9290ede494
Handle case of missing '@end' in implementation context
...
gracefully, on par with gcc, by: Issuing a warning,
doing final sematinc check of its definitions and generating
its meta-data.
llvm-svn: 88934
2009-11-16 18:57:01 +00:00
Eli Friedman
b774685c08
Fix a couple of tests.
...
llvm-svn: 88756
2009-11-14 04:23:25 +00:00
Ted Kremenek
9430bf20ff
Remove test case's dependency on header file.
...
llvm-svn: 88685
2009-11-13 20:03:22 +00:00
Ted Kremenek
e5e977013c
Add two new test cases for the Malloc/Free checker. Both have to do with
...
storing malloc'ed memory to global storage.
llvm-svn: 88684
2009-11-13 20:00:28 +00:00
Ted Kremenek
c2675568a1
Add test case that shows a leak we don't catch.
...
llvm-svn: 88683
2009-11-13 19:53:32 +00:00
Ted Kremenek
4ef13f8ac9
Add clang-cc option "--analyzer-experimental-internal-checks". This
...
option enables new "internal" checks that will eventually be turned on
by default but still require broader testing.
llvm-svn: 88671
2009-11-13 18:46:29 +00:00
Zhongxing Xu
c7460964ac
Malloc checker basically works now.
...
llvm-svn: 87094
2009-11-13 07:48:11 +00:00
Ted Kremenek
91989d166a
Split buffer overflow test case into two test cases, removing out logic that was commented out.
...
llvm-svn: 86845
2009-11-11 17:17:06 +00:00
Zhongxing Xu
b166712d02
Add undefined array subscript checker.
...
llvm-svn: 86837
2009-11-11 13:42:54 +00:00
Zhongxing Xu
4f7759a339
Reimplement out-of-bound array access checker with the new checker interface.
...
Now only one test case is XFAIL'ed.
llvm-svn: 86834
2009-11-11 12:33:27 +00:00
Ted Kremenek
04552cbef0
CastToStructChecker: use 'isStructureType()' instead of 'isRecordType()' to determine if a pointer is casted to a struct pointer. This fixes an observed false positive when a value is casted to a union.
...
llvm-svn: 86813
2009-11-11 06:43:42 +00:00
Zhongxing Xu
70ba4908d0
Add test case for PointerSubChecker.
...
llvm-svn: 86657
2009-11-10 02:45:49 +00:00
Zhongxing Xu
80bbc6d138
Refine PointerSubChecker: compare the base region instead of the original
...
region, so that arithmetic within a memory chunk is allowed.
llvm-svn: 86652
2009-11-10 02:37:53 +00:00
Zhongxing Xu
6d967cbd8e
update test case.
...
llvm-svn: 86541
2009-11-09 13:56:44 +00:00
Zhongxing Xu
ab0e27ff0c
Add check for pointer arithmetic on non-array variables.
...
llvm-svn: 86538
2009-11-09 13:23:31 +00:00
Zhongxing Xu
d6e7f9d4b2
Add check for obsolete function call of getpw().
...
llvm-svn: 86537
2009-11-09 12:19:26 +00:00
Zhongxing Xu
f06c684a33
Add checker for CWE-588: Attempt to Access Child of a Non-structure Pointer.
...
llvm-svn: 86529
2009-11-09 08:07:38 +00:00
Zhongxing Xu
6c306c8b89
Add checker for CWE-587: Assignment of a Fixed Address to a Pointer.
...
llvm-svn: 86523
2009-11-09 06:52:44 +00:00
Zhongxing Xu
86b1e01c13
Add checker for CWE-469: Use of Pointer Subtraction to Determine Size. This
...
checker does not build sink nodes. Because svaluator computes an unknown value
for the subtraction now.
llvm-svn: 86517
2009-11-09 05:34:10 +00:00
Zhongxing Xu
0f92ec6ebd
Add a test case for CWE-467, and simplify the wording of the warning.
...
llvm-svn: 86504
2009-11-09 02:28:12 +00:00
Daniel Dunbar
8b57697954
Eliminate &&s in tests.
...
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.
llvm-svn: 86430
2009-11-08 01:45:36 +00:00
John McCall
fceb64bd04
Implement -Wconversion. Off by default, in the non-gcc group. There's
...
significant work left to be done to reduce the false-positive rate here.
llvm-svn: 86326
2009-11-07 03:30:10 +00:00
Ted Kremenek
e3423e84a9
testing: Merge PR3135.c into misc-ps-region-store.m.
...
llvm-svn: 86286
2009-11-06 20:32:38 +00:00
Ted Kremenek
df9ca633b6
Sentence-case bug type, and pull tests from region-only-test.c into misc-ps-region.store.m (removing an extra unneeded test file). Also add a bunch of FIXME comments for future enhancements.
...
llvm-svn: 86282
2009-11-06 20:16:31 +00:00
Nuno Lopes
ac5eba93ca
add test case for PR3135 which was already fixed
...
llvm-svn: 86273
2009-11-06 18:42:13 +00:00
Zhongxing Xu
167bce9cf1
Add a checker for CWE-466: Return of Pointer Value Outside of Expected Range.
...
llvm-svn: 86252
2009-11-06 13:30:44 +00:00
Ted Kremenek
c92ff053e9
Tweak wording and classifications of analyzer diagnostics.
...
llvm-svn: 86127
2009-11-05 08:30:12 +00:00