aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker
AgeCommit message (Collapse)Author
2010-08-17Rewrite code fragment to avoide ICE in MSVC. Fixes PR 7875. Patch by ↵Ted Kremenek
Dimitry Andric! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111327 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17StringRef'ication of lots stuff, patch by Peter Davies!Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17Remove dead code.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17Convert all uses of StringLiteral::getStrData() to StringLiteral::getString()Benjamin Kramer
and remove getStrData(). Patch by Peter Davies (with some tweaks). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111229 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17Generate a node instead of a sink. A leak is not a fatal error.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111217 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Allow the "size" of a buffer access check to be either signed or unsigned. ↵Jordy Rose
Fixes PR7925. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Added basic psuedoconstant checking in IdempotentOperationChecker and fixed ↵Tom Care
some test cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111190 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Instead of using operator bool() for testing if a BindingKey is valid, use ↵Jordy Rose
an explicit isValid() method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111181 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Move GRState::AssumeInBound out of its header file -- it's not really ↵Jordy Rose
inline-friendly anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111179 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Model the effects of strcpy() and stpcpy() in CStringChecker. Other changes:Jordy Rose
- Fix memcpy() and friends to actually invalidate the destination buffer. - Emit a different message for out-of-bounds buffer accesses if the buffer is being written to. - When conjuring symbols, let ValueManager figure out the type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16- Allow making ElementRegions with complex offsets (expressions or symbols) ↵Jordy Rose
for the purpose of bounds-checking. - Rewrite GRState::AssumeInBound to actually do that checking, and to use the normal constraint path. - Remove ConstraintManager::AssumeInBound. - Teach RegionStore and FlatStore to ignore those regions for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111116 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15Move GRState's bind* methods out of its header file -- they're too big for ↵Jordy Rose
inlining now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15StoreManager::RemoveDeadBindings() can take a Store instead of an entire ↵Zhongxing Xu
GRState now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111103 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15Remove redundant method.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111099 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15Implement MallocChecker::EvalDeadSymbols() with the new API. This time weZhongxing Xu
iterate over symbols being tracked, instead of symbols being dead. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15Remove dead code, caught by unused function warnings.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14Update CStringChecker to take advantage of the new metadata symbols and ↵Jordy Rose
region change callback. Now does basic tracking of string length for general regions. Currently this is still only used for modeling strlen(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111081 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14Add a callback for when region changes occur. Still somewhat of a ↵Jordy Rose
work-in-progress, but working! Effect on clients: all changes to a store now go through GRState. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14Another metadata symbol change (missed a file)Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111077 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14Add a new metadata symbol type for checkers to use. Metadata symbols must be ↵Jordy Rose
associated with a region and will be collected if the region dies or its checker fails to mark it as in use. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111076 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13Zap unused UnaryOperator::OffsetOf.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12Small changes to UnreachableCodeCheckerTom Care
- Added detection of Empty CFGBlocks (artificial blocks) - Relaxed an assertion based on an incorrect assumption until further investigation git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110974 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12Improved IdempotentOperationChecker false positives and false negatives.Tom Care
- Unfinished analysis may still report valid warnings if the path was completely analyzed - New 'CanVary' heuristic to recursively determine if a subexpression has a varying element - Updated test cases, including one known bug - Exposed GRCoreEngine through GRExprEngine git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110970 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12Remove OwnershipAttr::Kind, since it's essentially redundant with attr::Kind ↵Jordy Rose
the way it's being used. Also fix isa<OwnershipAttr> support, break more-than-80-char lines, and other miscellaneous ownership attr cleanup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110908 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12Actually use reduced set of checkers in EvalAssume.Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110904 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11MemRegion can refer to ASTContext without external help.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110784 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11Have GRCoreEngine record the blocks where analysis was aborted because we ↵Ted Kremenek
visited a block too many times along a given path. This is to support the unreachable code analysis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110755 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-09Allow EvalBinOpNN to handle expressions of the form $a+$b if $b can be ↵Jordy Rose
reduced to a constant. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110592 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07Allow reference binding of a reference of Objective-C object type toDouglas Gregor
an lvalue of another, compatible Objective-C object type (e.g., a subclass). Introduce a new initialization sequence step kind to describe this binding, along with a new cast kind. Fixes PR7741. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110513 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06Removed IdempotentOperationChecker from default analysis and returned back ↵Tom Care
to a flag (-analyzer-check-idempotent-operations) - Added IdempotentOperationChecker to experimental analyses for testing purposes - Updated test cases to explictly call the checker git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110482 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06Fix 80 col. violations.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06Nest variable declaration into into 'if' condition, thus restricting the ↵Ted Kremenek
scope of the variable and condensing the code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110472 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06Use 'GenerateNode()' instead of 'GenerateSink()' when reporting a leak. A ↵Ted Kremenek
leak is not a hard enough bug to stop analyzing a path. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110471 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06If all nodes are sunk, bail out early. This make the later check for ↵Zhongxing Xu
checkersEvaluated really meaningful. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110430 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Don't assert on a file stream if its state is not tracked. Fix pr7831.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110392 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05When checking if a buffer access is valid, first make sure the buffer has a ↵Jordy Rose
valid Loc. Fixes PR7830. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110390 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Fixed logic error in UnreachableCodeChecker's marking algorithm that would ↵Tom Care
sometimes allow for multiple sequential statements to be flagged. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110353 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Revert r110317, and add a comment why the assertion is not an invariant.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110330 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Make checker recognize OffsetOfExpr as a form of __builtin_offsetof.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Turn the predicate into an assertion. When could the unequal case happen?Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110317 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Tweak GRState::unbindLoc to use makeWithStore, and make sure it's only ↵Jordy Rose
called for non-region locations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110310 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Remove InvalidateRegion from stores, since it's no longer called from outside.Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110309 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Correctly handle 'Class<...>' when examining Cocoa conventions in the static ↵Ted Kremenek
analyzer. Fixes a crash reported in <rdar://problem/8272168>. Patch by Henry Mason! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110289 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-04Change the checker callback cache in GRExprEngine to be more compact (and ↵Jordy Rose
IMHO a little easier to understand), and add the same sort of caching for EvalAssume (tied for least-used callback), mostly as proof-of-concept. Before we go further with these, we should figure out a way to reuse the visit-and-cache code in CheckerVisit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03Improved false positive detection and numerous small issues in ↵Tom Care
UnreachableCodeChecker - Reporting now uses getUnreachableStmt which returns the Stmt* we should report - Indexing of reachable and visited blocks now use CFGBlock ID's instead of pointers - The CFG used in the unreachable search is now the unoptimized CFG - Added 'Dead code' category to warnings - Removed obsolete function getCondition - Simplified false positive detection based on properties of FindUnreachableEntryPoints git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03Makes GRState::makeWithStore private, to encourage clients to make store ↵Jordy Rose
changes through GRState instead of directly accessing the StoreManager. Also adds cover methods for InvalidateRegion(s) and EnterStackFrame to GRState. This is in preparation for proposed region change notifications. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03Allow offsets to be negative. Out-of-bound cases are checked elsewhere. We Zhongxing Xu
shouldn't put restrictions in store manager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110106 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03Pull the region offset computation logic into a single method.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110102 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03Changed GRExprEngine to pass down a reference to itself when checkers are ↵Tom Care
doing postanalysis. This allows the checker to gather information about the state of the engine when it has finished. - Exposed the worklist and BlockAborted flag in GRCoreEngine - Changed postanalysis checkers to use the new infrastructure git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110095 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03Add -cc1 option '-unoptimized-cfg' to toggle using a CFG (for static ↵Ted Kremenek
analysis) that doesn't prune CFG edges. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110087 91177308-0d34-0410-b5e6-96231b3b80d8