summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker
Commit message (Collapse)AuthorAgeFilesLines
...
* Cleanup on CStringChecker and its associated tests. Also check for null ↵Jordy Rose2010-07-071-8/+77
| | | | | | arguments...which are allowed if the access length is 0! llvm-svn: 107759
* Change explicit handling of impossible condition to call llvm_unreachable in ↵Tom Care2010-07-071-2/+2
| | | | | | IdempotentOperationChecker::PreVisitBinaryOperator. llvm-svn: 107748
* Silence an annoying GCC warning about use of an uninitialized variable. EvenChandler Carruth2010-07-071-1/+1
| | | | | | | making the other switch case unreachable, or sinking the 'continue' into it doesn't silence this. llvm-svn: 107745
* Use 'llvm_unreachable' to mark impossible code paths so that GCC doesn'tChandler Carruth2010-07-071-1/+2
| | | | | | consider them for warnings. llvm-svn: 107741
* Fix casts in RegionStore to not always assume that bindings are only to ↵Ted Kremenek2010-07-061-4/+4
| | | | | | | | SubRegions. Fixes assertion failure reported in PR 7572. llvm-svn: 107738
* Implement dumpToStream() for NonStaticGlobalSpaceRegion and ↵Ted Kremenek2010-07-061-1/+8
| | | | | | StaticGlobalSpaceRegion. llvm-svn: 107731
* Add comment noting VLASizeChecker's duty in defining a VLA's extent.Jordy Rose2010-07-061-0/+6
| | | | llvm-svn: 107728
* Add a new path-sensitive checker for functions in <string.h>, for both ↵Jordy Rose2010-07-064-0/+361
| | | | | | null-terminated strings and memory blocks. Currently only checks memcpy(), memmove(), and bcopy(), but this is intended to be expanded soon. llvm-svn: 107722
* Sort CMake file.Ted Kremenek2010-07-061-9/+9
| | | | llvm-svn: 107709
* Added a path-sensitive idempotent operation checker ↵Tom Care2010-07-065-3/+466
| | | | | | | | | | | | | | | | | | | (-analyzer-idempotent-operation). Finds idempotent and/or tautological operations in a path sensitive context, flagging operations that have no effect or a predictable effect. Example: { int a = 1; int b = 5; int c = b / a; // a is 1 on all paths } - New IdempotentOperationChecker class - Moved recursive Stmt functions in r107675 to IdempotentOperationChecker - Minor refactoring of SVal to allow checking for any integer - Added command line option for check - Added basic test cases llvm-svn: 107706
* Add an assertion.Zhongxing Xu2010-07-061-0/+3
| | | | llvm-svn: 107645
* Remove the now-unused GRState::isEqual method. Instead of asking if an ↵Jordy Rose2010-07-061-25/+0
| | | | | | expression equals a certain value, use SValuator::EvalEQ and GRState::Assume to see if it can, must, or must not equal that value. llvm-svn: 107638
* Improve NULL-checking for CFRetain/CFRelease. We now remember that the ↵Jordy Rose2010-07-062-44/+52
| | | | | | argument was non-NULL, and we report where the null assumption came from (like AttrNonNullChecker already did). llvm-svn: 107633
* Support sizeof for VLA expressions (sizeof(someVLA)). sizeof(int[n]) still ↵Jordy Rose2010-07-051-3/+32
| | | | | | unimplemented. A VLA region's sizeof value matches its extent. llvm-svn: 107611
* Track extents for VLAs.Jordy Rose2010-07-052-7/+38
| | | | llvm-svn: 107603
* Add a new symbol type, SymbolExtent, to represent the extents of memory ↵Jordy Rose2010-07-047-133/+148
| | | | | | | | | | regions that may not be known at compile-time (such as those created by malloc). This replaces the old setExtent/getExtent API on Store, which used the GRState's GDM to store SVals. Also adds a getKnownValue() method to SValuator, which gets the integer value of an SVal if it is known to only have one possible value. There are more places in the code that could be using this, but in general we want to be dealing entirely in SVals, so its usefulness is limited. The only visible functionality change is that extents are now honored for any DeclRegion, such as fields and Objective-C ivars, rather than just variables. This shows up in bounds-checking and cast-size-checking. llvm-svn: 107577
* Fix PR 7475 by enhancing the static analyzer to also invalidate bindings for ↵Ted Kremenek2010-07-017-187/+358
| | | | | | | | | | | non-static global variables when calling a function/method whose impact on global variables we cannot accurately estimate. This change introduces two new MemSpaceRegions that divide up the memory space of globals, and causes RegionStore and BasicStore to consult a binding to the NonStaticGlobalsMemSpaceRegion when lazily determining the value of a global. llvm-svn: 107423
* Add an ivar to SymbolReaper for the current statement, and then stop passing ↵Jordy Rose2010-07-019-27/+24
| | | | | | the current statement around everywhere. Preparation for symbolic extents. llvm-svn: 107422
* ExplodedGraph never uses ASTContext, remove it.Zhongxing Xu2010-07-012-4/+4
| | | | llvm-svn: 107388
* Correctly implement the CheckerVisit optimization introduced in r106884, but ↵Ted Kremenek2010-06-301-1/+1
| | | | | | this time actually used the cached checker list when calling back to Checker visit methods. This reduces the analysis time for sqlite3.c by 8%. llvm-svn: 107259
* Pointers casted as integers still count as locations to SimpleSValuator, so ↵Jordy Rose2010-06-301-1/+6
| | | | | | don't crash if we do a funny thing like ((int)ptr)&1. Fixes PR7527. llvm-svn: 107236
* Tweaker Checker::VisitEndAnalysis to have 'hasWorkRemaining' alsoTed Kremenek2010-06-291-2/+5
| | | | | | | be true if some paths were aborted because they exceeded the maximum loop unrolling count. llvm-svn: 107209
* llvm::errs() is non-buffered, so it doesn't need to be flushed.Dan Gohman2010-06-281-2/+2
| | | | llvm-svn: 107012
* Pointer comparisons (and pointer-pointer subtraction). Basically filling in ↵Jordy Rose2010-06-283-58/+322
| | | | | | SimpleSValuator::EvalBinOpLL(). llvm-svn: 106992
* Implicitly compare symbolic expressions to zero when they're being used as ↵Jordy Rose2010-06-271-3/+7
| | | | | | constraints. Part of PR7491. llvm-svn: 106972
* Allow '__extension__' to be analyzed in a lvalue context.Ted Kremenek2010-06-261-2/+6
| | | | llvm-svn: 106964
* Relax assertion since non-pod C++ classes are not aggregates, but still can ↵Ted Kremenek2010-06-251-4/+9
| | | | | | appear in this context. llvm-svn: 106919
* When a constant size array is casted to another type, its length should be ↵Jordy Rose2010-06-251-4/+9
| | | | | | scaled as well. llvm-svn: 106911
* Add "checker caching" to GRExprEngine::CheckerVisit to progressively buildTed Kremenek2010-06-251-3/+51
| | | | | | | | | | | | a winowed list of checkers that actually do something for a given StmtClass. As the number of checkers grows, this may potentially significantly reduce the number of checkers called at any one time. My own measurements show that for the ~20 registered Checker objects, only ~5 of them respond at any one time to a give statement. While this isn't a net performance win right now (there is a minor slowdown on sqlite.3) this improvement does greatly improve debugging when stepping through the checkers used to evaluate a given statement. llvm-svn: 106884
* Fix -analyze-display-progress (once again), this time with an additional ↵Ted Kremenek2010-06-251-5/+4
| | | | | | regression test. llvm-svn: 106883
* Change RegionStoreManager::Retrieve to infer the type of a symbolic region ↵Tom Care2010-06-251-1/+6
| | | | | | from the context when it is not already available. llvm-svn: 106868
* Return null pointer instead of 'false' (fixes clang warning).Ted Kremenek2010-06-241-1/+1
| | | | llvm-svn: 106755
* Add check for illegal whence argument of fseek.Zhongxing Xu2010-06-241-3/+28
| | | | llvm-svn: 106742
* Should return stateNotNull.Zhongxing Xu2010-06-241-1/+1
| | | | llvm-svn: 106741
* Let StreamChecker::CheckNullStream() return a GRState after successful check.Zhongxing Xu2010-06-241-15/+16
| | | | llvm-svn: 106738
* Add 'VisitEndAnalysis' callback to Checker class. This callback is called ↵Ted Kremenek2010-06-232-0/+8
| | | | | | | | | by GRExprEngine when the worklist algorithm has terminated. This allows some checkers to do a post-analysis phase after all paths have been analyzed. llvm-svn: 106689
* add comments.Zhongxing Xu2010-06-231-1/+5
| | | | llvm-svn: 106617
* add comments.Zhongxing Xu2010-06-231-1/+3
| | | | llvm-svn: 106616
* Correctly construct an ElementRegion for alloca() + pointer arithmetic. ↵Ted Kremenek2010-06-221-2/+1
| | | | | | | | Fixes analyzer crash reported in PR 7450. llvm-svn: 106609
* Type Type::isRealFloatingType() that vectors are not floating-pointDouglas Gregor2010-06-221-2/+2
| | | | | | | | | types, updating callers of both isFloatingType() and isRealFloatingType() accordingly. Caught at least one issue where we allowed one to declare a vector of vectors (!), along with cleaning up the standard-conversion logic for C++. llvm-svn: 106595
* Don't assert on C++ casts that are currently not handled by the static analyzer.Ted Kremenek2010-06-221-6/+24
| | | | | | | Instead, halt the analysis of the current path, which is what we do in GRExprEngine::ProcessStmt for all other C++ constructs not currently handled by the analyzer. llvm-svn: 106561
* Add a bunch of stream APIs to SteamChecker.Zhongxing Xu2010-06-221-22/+111
| | | | llvm-svn: 106530
* When folding additive operations, convert the values to the same type. When ↵Jordy Rose2010-06-212-26/+44
| | | | | | assuming relationships, convert the integers to the same type as the symbol, at least for now. llvm-svn: 106458
* If a nonnull argument evaluates to UnknownVal, don't warn (and don't crash).Jordy Rose2010-06-211-2/+7
| | | | llvm-svn: 106456
* Add braces to avoid an ambiguous else, fixing a GCC warning.Benjamin Kramer2010-06-201-3/+3
| | | | llvm-svn: 106403
* Adds analyzer support for idempotent and tautological binary operations such ↵Jordy Rose2010-06-201-9/+108
| | | | | | as "a*0" and "a+0". This is not very powerful, but does make the analyzer look a little smarter than it actually is. llvm-svn: 106402
* Casting to void* or any other pointer-to-sizeless type (e.g. function ↵Jordy Rose2010-06-201-0/+5
| | | | | | pointers) causes a divide-by-zero error. Simple fix: check if the pointee type size is 0 and bail out early if it is. llvm-svn: 106401
* Fold additive constants, and support comparsions of the form $sym+const1 <> ↵Jordy Rose2010-06-185-271/+462
| | | | | | const2 llvm-svn: 106339
* introduce a new CharSourceRange class, and enhance the diagnostics routinesChris Lattner2010-06-181-1/+1
| | | | | | | | | | | | | | | to use them instead of SourceRange. CharSourceRange is just a SourceRange plus a bool that indicates whether the range has the end character resolved or whether the end location is the start of the end token. While most of the compiler wants to think of ranges that have ends that are the start of the end token, the printf diagnostic stuff wants to highlight ranges within tokens. This is transparent to the diagnostic stuff. To start taking advantage of the new capabilities, you can do something like this: Diag(..) << CharSourceRange::getCharRange(Begin,End) llvm-svn: 106338
* Add null stream check for more APIs.Zhongxing Xu2010-06-181-16/+70
| | | | llvm-svn: 106274
OpenPOWER on IntegriCloud