aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Checker
AgeCommit message (Collapse)Author
2010-09-03Add optional record of "location" SVals in the environment. When we ↵Ted Kremenek
analyzing loads/stores, we lose the location SVal, which makes it difficult to recover in some cases (e.g., for post diagnostics). This is prep for pending changes to GRExprEngine. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03Add GRState::getSimplifiedSVal(), which provides an API hook for doing ↵Ted Kremenek
symbol -> constant folding. This isn't used yet, but is prep for some pending optimizations in GRExprEngine. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112929 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02Reapply 112850 and 112839 with a constructor for the BinaryOperatorData ↵Tom Care
struct. Clang would zero out the enum and pointer in the struct in some conditions, but GCC would never zero out the values. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112909 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02Reverting 112850 and 112839 due to test failures on some systemsTom Care
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02Improved error reporting in IdempotentOperationCheckerTom Care
- SourceRange highlighting is only given for the relevant side of the operator (assignments give both) - Added PostVisitBinaryOperator hook to retrieve the ExplodedNode for an operator - Added a BugReporterVisitor to display the last store to every VarDecl in a Stmt - Changed bug reporting to use the new BugReporterVisitor git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112839 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02For GRExprEngine::EvalBind() (and called visitors), unifiy StoreE and ↵Ted Kremenek
AssignE. Now StoreE (const Stmt*) represents the expression where the store took place, which is the assignment expression if it takes place in an assignment. This removes some conceptual dissidence as well as removes an extra parameter from the Checker::PreVisitBind() visitor. It also improves ranges and source location information in analyzer diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112789 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26Fix horrible GRExprEngine bug where switch statements with no 'case:' ↵Ted Kremenek
statements would cause the path to get prematurely aborted. Fixes <rdar://problem/8360854>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112233 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17TypedRegion::isBoundable() should return true by default. Since there is no ↵Ted Kremenek
TypedViewRegion anyore, it is not possible that the subclass (which doesn't override isBoundable) could return a null value type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111329 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-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-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-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-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-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-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-03Remove DoneEvaluating field (unused since r90296)Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110141 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
2010-08-02You actually have to include a header in order to use a symbol, it's so 90s..Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110034 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02Use llvm_unreachable.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110033 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02Shut up warnings in Release build.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02Improve flat store: MemRegion::getAsOffset() computes a region's offset withinZhongxing Xu
the top-level object. FlatStore now can bind and retrieve element and field regions. PR7297 is fixed by flat store. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110020 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27Extracted out some useful common functions in IdempotentOperationChecker to ↵Tom Care
their own CheckerHelpers file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109560 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23Change arg type.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109218 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23AnalysisContext is not const.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109210 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22Make a bunch of new data structures for the new analysisZhongxing Xu
engine of the new translation unit. State marshal is there but no real work is done. End nodes are passed back. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109105 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21Move some methods inline.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108988 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20Constify all references to Stmt* and CFGBlock* in libChecker.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108811 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20Constify.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19Reapply r108617.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108668 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17Revert r108617, it broke the build.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108621 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17Prepare the analyzer for the callee in another translation unit:Zhongxing Xu
Let AnalysisContext contain a TranslationUnit. Let CallEnter refer to an AnalysisContext instead of a FunctionDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108617 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06Implement dumpToStream() for NonStaticGlobalSpaceRegion and ↵Ted Kremenek
StaticGlobalSpaceRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06Added a path-sensitive idempotent operation checker ↵Tom Care
(-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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107706 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06Remove the now-unused GRState::isEqual method. Instead of asking if an ↵Jordy Rose
expression equals a certain value, use SValuator::EvalEQ and GRState::Assume to see if it can, must, or must not equal that value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107638 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-04Add a new symbol type, SymbolExtent, to represent the extents of memory ↵Jordy Rose
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01Fix PR 7475 by enhancing the static analyzer to also invalidate bindings for ↵Ted Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01Add an ivar to SymbolReaper for the current statement, and then stop passing ↵Jordy Rose
the current statement around everywhere. Preparation for symbolic extents. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01ExplodedGraph never uses ASTContext, remove it.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107388 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29Tweaker Checker::VisitEndAnalysis to have 'hasWorkRemaining' alsoTed Kremenek
be true if some paths were aborted because they exceeded the maximum loop unrolling count. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107209 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28Pointer comparisons (and pointer-pointer subtraction). Basically filling in ↵Jordy Rose
SimpleSValuator::EvalBinOpLL(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106992 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25Add "checker caching" to GRExprEngine::CheckerVisit to progressively buildTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23Add 'VisitEndAnalysis' callback to Checker class. This callback is called ↵Ted Kremenek
by GRExprEngine when the worklist algorithm has terminated. This allows some checkers to do a post-analysis phase after all paths have been analyzed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106689 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17Include the bug description in the report hash so that we can emit multiple ↵Ted Kremenek
bugs of the same type at the same location. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106209 91177308-0d34-0410-b5e6-96231b3b80d8