John McCall
d764625448
Add a few more complex-related cast kinds that arise due to arbitrary
...
implicit conversions; the last batch was specific to promotions.
I think this is the full set we need. I do think dividing the cast
kinds into floating and integral is probably a good idea.
Annotate a *lot* more C casts with useful cast kinds.
llvm-svn: 119036
2010-11-14 08:17:51 +00:00
John McCall
c5e62b47af
Introduce five new cast kinds for various conversions into and
...
between complex types.
llvm-svn: 118994
2010-11-13 09:02:35 +00:00
Ted Kremenek
f2819198d2
Refine IdempotentOperationChecker::PathWasCompletelyAnalyzed() to also check
...
BlockEdges, BlockEntrances, and BlockExits for the target block value.
llvm-svn: 118984
2010-11-13 05:12:26 +00:00
Ted Kremenek
cf9dbe9c20
Teach IdempotentOperations::PathWasCompletelyAnalyzed to also consider items remaining in the
...
worklist that could have impacted the evaluation of a block.
Fixes <rdar://problem/8663596>.
llvm-svn: 118983
2010-11-13 05:04:52 +00:00
Ted Kremenek
b02788dbee
Add GRWorkList::VisitItemsInWorkList() to allow a client to introspect the contents of a worklist.
...
This API required changing the BFS worklist to use a deque instead of a queue, but that is better
for performance reasons anyway.
llvm-svn: 118982
2010-11-13 05:04:49 +00:00
John McCall
e84af4e486
Introduce a null-to-pointer implicit cast kind.
...
llvm-svn: 118966
2010-11-13 01:35:44 +00:00
Douglas Gregor
453b012513
Make sure to always check the result of
...
SourceManager::getPresumedLoc(), so that we don't try to make use of
an invalid presumed location. Doing so can cause crashes.
llvm-svn: 118885
2010-11-12 07:15:47 +00:00
Ted Kremenek
843c53828f
RegionStore/BasicStore: do not return UndefinedVal for accesses to concrete addresses; instead return UnknownVal. This
...
leads it up to checkers (e.g., DereferenceChecker) to guard against illegal accesses (e.g., null dereferences).
Fixes PR 5272 and <rdar://problem/6839683>.
llvm-svn: 118852
2010-11-11 23:10:10 +00:00
Ted Kremenek
dcf85a8d18
Teach AttrNonNullChecker about transparent unions. Fixes crash reported in <rdar://problem/8642434>.
...
llvm-svn: 118473
2010-11-09 02:11:43 +00:00
Ted Kremenek
14715b7f2f
Only enable the ObjCAtSyncChecker when the translation unit uses Objective-C.
...
llvm-svn: 118414
2010-11-08 16:52:54 +00:00
Douglas Gregor
4b8eca88b0
Teach the CStringChecker and PthreadLockChecker about non-identifier
...
declaration names, from Jim Goodnow II!
llvm-svn: 117970
2010-11-01 23:16:05 +00:00
Zhongxing Xu
627a1868d2
Now initializer of C++ record type is visited as block-level expr.
...
Let the destination of AggExprVisitor be an explicit MemRegion.
Reenable the test case.
llvm-svn: 117908
2010-11-01 09:09:44 +00:00
Zhanyong Wan
e4f7df694d
Make Clang static analyzer skip function template definitions. This fixes Clang PR 8426, 8427, & 8433. Reviewed by Ted Kremenek and Doug Gregor.
...
llvm-svn: 117853
2010-10-31 04:22:34 +00:00
Ted Kremenek
310c5a8e31
Don't flag idempotent '+' or '-' warnings for pointer arithmetic (typically false positives).
...
Fixes <rdar://problem/8601243>.
llvm-svn: 117635
2010-10-29 01:06:54 +00:00
Ted Kremenek
0abd85c7ae
Don't warn about unamed bitfield ivars in the ObjCUnusedIvarsChecker. Fixes <rdar://problem/8481311>.
...
llvm-svn: 117521
2010-10-28 02:16:22 +00:00
Ted Kremenek
6348dac7a0
Fix lazy symbolication bug in RegionStore involving fields of global variables. When invalidated, the entire
...
globals memory space gets assigned a symbolic value, but that value was not being used for lazy symbolication
of fields of globals. This could result in cases where bogus null dereferences were being reported.
Fixes PR 8440.
llvm-svn: 117336
2010-10-26 00:06:17 +00:00
Ted Kremenek
f59449e790
Move 'includeGlobals' as a field into ClusterAnalysis.
...
llvm-svn: 117335
2010-10-26 00:06:15 +00:00
Ted Kremenek
731310e13e
Tweak null dereference checker to give better diagnostics for null dereferences resulting from array accesses.
...
llvm-svn: 117334
2010-10-26 00:06:13 +00:00
Ted Kremenek
c07d8353e1
Add check for UnknownVals for mutexes in ObjCAtSyncChecker. Fixes crash reported in PR 8458.
...
llvm-svn: 117300
2010-10-25 20:20:56 +00:00
Ted Kremenek
7043fba7fa
Fix '-analyzer-display-progress' for Objective-C methods. Also remove obsolete code.
...
llvm-svn: 117161
2010-10-22 22:08:29 +00:00
Benjamin Kramer
2fc373e155
Move classes into anonymous namespaces.
...
llvm-svn: 117104
2010-10-22 16:33:16 +00:00
Ted Kremenek
c5644e1b97
Tweak the ObjCAtSyncChecker to assume that a mutex is non-nil after checking that it is
...
nil. Otherwise we can get false paths where a second @synchronized using the mutex
can have a bogus warning. Fixes <rdar://problem/8578650>.
llvm-svn: 117016
2010-10-21 15:38:55 +00:00
Ted Kremenek
6377965efb
Remove unused variable.
...
llvm-svn: 116995
2010-10-21 04:00:51 +00:00
Ted Kremenek
982b32b1b6
Remove obsolete GRAuditor and GRSimpleAPICheck, which have been completely subsumed by the Checker interface.
...
llvm-svn: 116973
2010-10-20 23:48:34 +00:00
Ted Kremenek
bd2c800882
Convert GRSimpleAPIChecks in BasicObjCFoundationChecks to be Checkers.
...
llvm-svn: 116971
2010-10-20 23:38:56 +00:00
Ted Kremenek
4f63ac7057
Tweak retain/release checker diagnostics to specify a leak occurs because an object is not referenced later in the path,
...
not that it isn't referenced later in the code. Fixes <rdar://problem/8527839>.
llvm-svn: 116636
2010-10-15 22:50:23 +00:00
Fariborz Jahanian
681c0754d9
Eliminate usage of ObjCSuperExpr used for
...
'super' as receiver of property or a setter/getter
methods. //rdar: //8525788
llvm-svn: 116483
2010-10-14 16:04:05 +00:00
Zhongxing Xu
23e082d32c
Call PreVisitDeclStmt for C++ aggregate initializers. Patch by Jim Goodnow II.
...
llvm-svn: 116473
2010-10-14 05:22:59 +00:00
Chris Lattner
29e78ac923
comment out unused function
...
llvm-svn: 116189
2010-10-11 05:38:10 +00:00
Francois Pichet
52bea03e7a
Unbreak the CMake build.
...
llvm-svn: 116164
2010-10-10 09:17:09 +00:00
Zhongxing Xu
271c9c7b6d
Add experimental chroot check which checks improper use of chroot(). Patch by
...
Lei Zhang.
llvm-svn: 116163
2010-10-10 05:45:30 +00:00
Tom Care
ea53e82c78
UnreachableCodeChecker cleanup and improvements
...
- Fixed some iterator style issues
- Don't process blocks that have been visited already
- Fixed a case where a unreachable block cycle was not reported
- Minor test case changes
- Added one test case from flow-sensitive version of the check. More coming.
llvm-svn: 115861
2010-10-06 23:02:25 +00:00
Tom Care
7359459636
UnreachableCodeChecker does not need to inherit from CheckerVisitor, only Checker. It does not use any AST Stmt hooks, only VisitEndAnalysis.
...
llvm-svn: 115345
2010-10-01 20:52:07 +00:00
Marcin Swiderski
99a9040a1f
Added two new command line arguments:
...
-cfg-add-implicit-dtors - sets CFG::BuildOptions::AddImplicitDtors for AnalysisCosumer to true,
-cfg-add-initializers - sets CFG::BuildOptions::AddInitializers for AnalysisCosumer to true.
llvm-svn: 115142
2010-09-30 07:41:24 +00:00
Ted Kremenek
b0e7d77729
Include changes to VisitCXXMemberCallExpr (call visitor functions).
...
llvm-svn: 115120
2010-09-30 01:06:29 +00:00
Ted Kremenek
3d6c0c0091
Tweak nil receiver checker to not warning about 64-bit return values.
...
Fixes: <rdar://problem/7513117>
llvm-svn: 115113
2010-09-30 00:37:10 +00:00
Tom Care
2f0419e1f8
AnalyzerStatsChecker improvements:
...
- Use BlockEntrance rather than BlockEdge to bring in line with UnreachableCodeChecker. Fixes an issue where unreached blocks would still be counted as reachable.
- Added warnings for all BlockAborted locations. This allows us to see where the analyzer stopped analyzing.
llvm-svn: 115110
2010-09-29 23:48:34 +00:00
Tom Care
472205be35
Change -analyzer-max-nodes to allow 0 as a parameter. This allows the analyzer to completely analyze a worklist regardless of time taken.
...
llvm-svn: 115108
2010-09-29 23:48:13 +00:00
Ted Kremenek
fd5856adcb
Refactor GRExprEngine::VisitCall() to use EvalArguments(), just like VisitCXXMemberCallExpr(). Ideally we should unify these code paths as much as possible, since they only differ by a few details.
...
llvm-svn: 114628
2010-09-23 05:14:51 +00:00
Tom Care
14fefab721
Fix an inverse boolean and unnecessary new line in warning output from AnalyzerStatsChecker.
...
llvm-svn: 114581
2010-09-22 21:07:51 +00:00
Tom Care
0bd3431a5e
Revert r114244 since it breaks a test in Analysis.
...
llvm-svn: 114246
2010-09-18 00:17:17 +00:00
Tom Care
0f99e64305
IdempotentOperationChecker no longer reports errors that are post-dominated by a sink. This fixes some false positives that were flagged because a path was incomplete (usually in a loop).
...
llvm-svn: 114244
2010-09-18 00:06:34 +00:00
Tom Care
58191966bc
Refactored BugReporter to refer to EndNode as ErrorNode. We currently make the assumption that EndNode == ErrorNode, but upcoming changes will break this.
...
llvm-svn: 114065
2010-09-16 03:50:38 +00:00
Zhongxing Xu
2cd7a78c76
Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patch
...
and discussions with Ted and Jordy.
llvm-svn: 114056
2010-09-16 01:25:47 +00:00
Ted Kremenek
c4deb92316
Disallow the use of UnknownVal as the index for ElementRegions. UnknownVals can be used as
...
the index when the value evaluation isn't powerful enough. By creating ElementRegions with
UnknownVals as the index, this gives the false impression that they are the same element, when
they really aren't. This becomes really problematic when deriving symbols from these regions
(e.g., those representing the initial value of the index), since two different indices will
get the same symbol for their binding.
This fixes an issue with the idempotent operations checker that would cause two indices that
are clearly not the same to make it appear as if they always had the same value.
Fixes <rdar://problem/8431728>.
llvm-svn: 113920
2010-09-15 03:13:30 +00:00
Ted Kremenek
72c9b0d582
Adjust assertion in RegionStoreManager::RetrieveArray() to also take into account typedefs.
...
llvm-svn: 113893
2010-09-14 23:29:38 +00:00
Ted Kremenek
c95589d2e6
Don't divide-by-zero in RegionStoreManager::getSizeInElements() when getting the size of a VLA. We don't track VLA extents yet,
...
but we should at least not crash. Fixes <rdar://problem/8424269>.
llvm-svn: 113888
2010-09-14 23:08:34 +00:00
Tom Care
c88ed9561e
Rename 'MaxLoop' to 'MaxVisit' in AnalysisManager to more correctly reflect that we aborted analysis may not necessarily be due to a loop.
...
llvm-svn: 113862
2010-09-14 21:35:27 +00:00
Michael J. Spencer
09476212de
Revert "CMake: Update to use standard CMake dependency tracking facilities instead"
...
This reverts commit r113631
Conflicts:
CMakeLists.txt
lib/CodeGen/CMakeLists.txt
llvm-svn: 113817
2010-09-13 23:54:41 +00:00
Michael J. Spencer
0881f4a367
CMake: Update to use standard CMake dependency tracking facilities instead
...
of whatever we were using before...
llvm-svn: 113631
2010-09-10 21:13:16 +00:00