summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker
Commit message (Collapse)AuthorAgeFilesLines
* Small changes to UnreachableCodeCheckerTom Care2010-08-121-3/+20
| | | | | | | - Added detection of Empty CFGBlocks (artificial blocks) - Relaxed an assertion based on an incorrect assumption until further investigation llvm-svn: 110974
* Improved IdempotentOperationChecker false positives and false negatives.Tom Care2010-08-121-98/+203
| | | | | | | | | - 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 llvm-svn: 110970
* Remove OwnershipAttr::Kind, since it's essentially redundant with attr::Kind ↵Jordy Rose2010-08-121-19/+17
| | | | | | the way it's being used. Also fix isa<OwnershipAttr> support, break more-than-80-char lines, and other miscellaneous ownership attr cleanup. llvm-svn: 110908
* Actually use reduced set of checkers in EvalAssume.Jordy Rose2010-08-121-2/+1
| | | | llvm-svn: 110904
* MemRegion can refer to ASTContext without external help.Zhongxing Xu2010-08-1117-60/+48
| | | | llvm-svn: 110784
* Have GRCoreEngine record the blocks where analysis was aborted because we ↵Ted Kremenek2010-08-111-3/+4
| | | | | | visited a block too many times along a given path. This is to support the unreachable code analysis. llvm-svn: 110755
* Allow EvalBinOpNN to handle expressions of the form $a+$b if $b can be ↵Jordy Rose2010-08-091-4/+19
| | | | | | reduced to a constant. llvm-svn: 110592
* Allow reference binding of a reference of Objective-C object type toDouglas Gregor2010-08-071-1/+2
| | | | | | | | 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. llvm-svn: 110513
* Removed IdempotentOperationChecker from default analysis and returned back ↵Tom Care2010-08-065-3/+9
| | | | | | | | | to a flag (-analyzer-check-idempotent-operations) - Added IdempotentOperationChecker to experimental analyses for testing purposes - Updated test cases to explictly call the checker llvm-svn: 110482
* Fix 80 col. violations.Ted Kremenek2010-08-061-6/+14
| | | | llvm-svn: 110473
* Nest variable declaration into into 'if' condition, thus restricting the ↵Ted Kremenek2010-08-061-7/+3
| | | | | | scope of the variable and condensing the code. llvm-svn: 110472
* Use 'GenerateNode()' instead of 'GenerateSink()' when reporting a leak. A ↵Ted Kremenek2010-08-061-3/+3
| | | | | | leak is not a hard enough bug to stop analyzing a path. llvm-svn: 110471
* If all nodes are sunk, bail out early. This make the later check for ↵Zhongxing Xu2010-08-061-1/+4
| | | | | | checkersEvaluated really meaningful. llvm-svn: 110430
* Don't assert on a file stream if its state is not tracked. Fix pr7831.Zhongxing Xu2010-08-051-1/+4
| | | | llvm-svn: 110392
* When checking if a buffer access is valid, first make sure the buffer has a ↵Jordy Rose2010-08-051-11/+15
| | | | | | valid Loc. Fixes PR7830. llvm-svn: 110390
* Fixed logic error in UnreachableCodeChecker's marking algorithm that would ↵Tom Care2010-08-051-3/+6
| | | | | | sometimes allow for multiple sequential statements to be flagged. llvm-svn: 110353
* Revert r110317, and add a comment why the assertion is not an invariant.Ted Kremenek2010-08-051-4/+4
| | | | llvm-svn: 110330
* Make checker recognize OffsetOfExpr as a form of __builtin_offsetof.Eli Friedman2010-08-051-1/+4
| | | | llvm-svn: 110320
* Turn the predicate into an assertion. When could the unequal case happen?Zhongxing Xu2010-08-051-1/+3
| | | | llvm-svn: 110317
* Tweak GRState::unbindLoc to use makeWithStore, and make sure it's only ↵Jordy Rose2010-08-051-3/+3
| | | | | | called for non-region locations. llvm-svn: 110310
* Remove InvalidateRegion from stores, since it's no longer called from outside.Jordy Rose2010-08-052-18/+2
| | | | llvm-svn: 110309
* Correctly handle 'Class<...>' when examining Cocoa conventions in the static ↵Ted Kremenek2010-08-051-2/+3
| | | | | | analyzer. Fixes a crash reported in <rdar://problem/8272168>. Patch by Henry Mason! llvm-svn: 110289
* Change the checker callback cache in GRExprEngine to be more compact (and ↵Jordy Rose2010-08-042-27/+68
| | | | | | | | 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. llvm-svn: 110191
* Improved false positive detection and numerous small issues in ↵Tom Care2010-08-031-77/+60
| | | | | | | | | | | | | 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 llvm-svn: 110148
* Makes GRState::makeWithStore private, to encourage clients to make store ↵Jordy Rose2010-08-035-20/+17
| | | | | | | | 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. llvm-svn: 110137
* Allow offsets to be negative. Out-of-bound cases are checked elsewhere. We Zhongxing Xu2010-08-032-6/+5
| | | | | | shouldn't put restrictions in store manager. llvm-svn: 110106
* Pull the region offset computation logic into a single method.Zhongxing Xu2010-08-032-43/+60
| | | | llvm-svn: 110102
* Changed GRExprEngine to pass down a reference to itself when checkers are ↵Tom Care2010-08-033-9/+9
| | | | | | | | | 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 llvm-svn: 110095
* Add -cc1 option '-unoptimized-cfg' to toggle using a CFG (for static ↵Ted Kremenek2010-08-032-2/+4
| | | | | | analysis) that doesn't prune CFG edges. llvm-svn: 110087
* Fix idempotent operations false positive caused by ivars not being ↵Ted Kremenek2010-08-021-2/+11
| | | | | | | | invalidated in function calls when the enclosing object had retain/release state. Fixes <rdar://problem/8261992>. llvm-svn: 110068
* Further adjustments to -Wglobal-constructors; works for references and directJohn McCall2010-08-021-1/+1
| | | | | | initializations now. llvm-svn: 110063
* 'Assumption &A' gets default initialized to 'Possible' if it doesn't exist; ↵Ted Kremenek2010-08-021-8/+5
| | | | | | | | no need to two lookups in the hashtable. llvm-svn: 110059
* Improve flat store: MemRegion::getAsOffset() computes a region's offset withinZhongxing Xu2010-08-025-17/+88
| | | | | | | | the top-level object. FlatStore now can bind and retrieve element and field regions. PR7297 is fixed by flat store. llvm-svn: 110020
* After a lengthy design discussion, add support for "ownership attributes" ↵Ted Kremenek2010-07-311-17/+156
| | | | | | for malloc/free checking. Patch by Andrew McGregor! llvm-svn: 109939
* Uncomment unfinished work bailout in IdempotentOperationsChecker.Tom Care2010-07-301-2/+2
| | | | llvm-svn: 109893
* Use a LazyCompoundVal to handle initialization with a string literal, rather ↵Jordy Rose2010-07-291-35/+12
| | | | | | than copying each character. llvm-svn: 109734
* Teach GRExprEngine::VisitLValue() about FloatingLiteral, ImaginaryLiteral, ↵Ted Kremenek2010-07-291-0/+3
| | | | | | and CharacterLiteral. Fixes an assertion failure reported in PR 7675. llvm-svn: 109719
* Augment RegionStore::BindStruct() to bind symbolicated struct values. This ↵Ted Kremenek2010-07-291-6/+8
| | | | | | fixes a false path issue reported in <rdar://problem/8243408> and also spurs another cause where the idempotent operations checker fires. llvm-svn: 109710
* Change SymbolManager::canSymbolicate() to return true for RecordTypes.Ted Kremenek2010-07-291-1/+10
| | | | llvm-svn: 109709
* Explicitly guard in BasicStore from storing to non-scalars.Ted Kremenek2010-07-291-5/+3
| | | | llvm-svn: 109708
* Remove extraneous guards around the call to getConjuredSymbolVal(). These ↵Ted Kremenek2010-07-291-6/+4
| | | | | | checks are already done within getConjuredSymbolVal() itself. llvm-svn: 109707
* Added some false positive checking to UnreachableCodeCheckerTom Care2010-07-271-31/+92
| | | | | | | | | - Allowed reporting of dead macros - Added path walking function to search for false positives in conditional statements - Updated some affected tests - Added some false positive test cases llvm-svn: 109561
* Extracted out some useful common functions in IdempotentOperationChecker to ↵Tom Care2010-07-273-86/+86
| | | | | | their own CheckerHelpers file. llvm-svn: 109560
* Finesse 'idempotent operations' analyzer issues to include the opcode of the ↵Ted Kremenek2010-07-271-10/+16
| | | | | | binary operator for clearer error reporting. Also remove the 'Idempotent operation' prefix in messages; it's redundant since the bug type is the same. llvm-svn: 109527
* Put 'Idempotent operations' static analyzer issues in the 'Dead code' category.Ted Kremenek2010-07-271-1/+2
| | | | llvm-svn: 109517
* Don't warn about unreachable code if the block starts with ↵Jordy Rose2010-07-271-1/+16
| | | | | | | | __builtin_unreachable(). The next step is to warn if a block labeled unreachable is, in fact, reachable. Somewhat related to PR810. llvm-svn: 109487
* Groundwork for C string length tracking. Currently only handles the length ↵Jordy Rose2010-07-271-2/+189
| | | | | | of constant string literals, which is not too helpful, and only calls to strlen() are checked. llvm-svn: 109480
* Added an path-sensitive unreachable code checker to the experimental ↵Tom Care2010-07-234-9/+154
| | | | | | | | | | analyzer checks. - Created a new class to do post-analysis - Updated several test cases with unreachable code to expect a warning - Added some general tests llvm-svn: 109286
* Add FILE* leak check to StreamChecker. Patch by Lei Zhang.Zhongxing Xu2010-07-231-3/+78
| | | | llvm-svn: 109225
* Change arg type.Zhongxing Xu2010-07-231-1/+1
| | | | llvm-svn: 109218
OpenPOWER on IntegriCloud