aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/GRExprEngineInternalChecks.cpp
AgeCommit message (Collapse)Author
2009-11-23UndefBranchChecker: more bug reporter helper information emit.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89643 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23Initial refactor of UndefBranchChecker. We still use GRBranchNodeBuilderZhongxing Xu
in the checker directly. But I don't have a better approach for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22Don't include a dead header.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89587 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22Remove UndefinedAssignmentChecker's header.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21Make FixedAddressChecker and experimental check; it currently produces a ton ↵Ted Kremenek
of false positives when analyzing some projects (e.g., Wine). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89560 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21Pull BadCallChecker int UndefinedArgChecker, and have UndefinedArgChecker ↵Ted Kremenek
also handled undefined receivers in message expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21More checker refactoring. Passing undefined values in a message expression ↵Ted Kremenek
is now handled by UndefinedArgChecker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89519 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13Add clang-cc option "--analyzer-experimental-internal-checks". ThisTed Kremenek
option enables new "internal" checks that will eventually be turned on by default but still require broader testing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11Remove some stale ErrorNodes variables in GRExprEngine and the old buffer ↵Ted Kremenek
overflow logic in GRExprEngineInternalChecks.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11Add undefined array subscript checker.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86837 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11Reimplement out-of-bound array access checker with the new checker interface.Zhongxing Xu
Now only one test case is XFAIL'ed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11Remove public headers for UndefinedArgChecker, AttrNonNullChecker, and ↵Ted Kremenek
BadCallChecker, making their implementations completely private. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86809 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11Refactor DereferenceChecker to use only the new Checker API instead ofTed Kremenek
the old builder API. This percolated a bunch of changes up to the Checker class (where CheckLocation has been renamed VisitLocation) and GRExprEngine. ProgramPoint now has the notion of a "LocationCheck" point (with PreLoad and PreStore respectively), and a bunch of the old ProgramPoints that are no longer used have been removed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86798 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09Add check for pointer arithmetic on non-array variables.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86538 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09Add checker for CWE-588: Attempt to Access Child of a Non-structure Pointer.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86529 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09Add checker for CWE-587: Assignment of a Fixed Address to a Pointer.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86523 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09Add checker for CWE-469: Use of Pointer Subtraction to Determine Size. ThisZhongxing Xu
checker does not build sink nodes. Because svaluator computes an unknown value for the subtraction now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86517 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06Make the VLASizeChecker implementation private, and its creation only known ↵Ted Kremenek
to GRExprEngineInternalChecks.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86292 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06Make the implementation of DivZeroChecker private.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06Add a checker for CWE-466: Return of Pointer Value Outside of Expected Range.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06static analyzer: refactor checking logic for returning the address of a ↵Ted Kremenek
stack variable or a garbage value into their own respective subclasses of Checker (and put them in .cpp files where their implementation details are hidden from GRExprEngine). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86215 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04Catch uses of undefined values when they are used in assignment, thus ↵Ted Kremenek
catching such bugs closer to the source. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86003 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04Merge ZeroSizedVLAChecker and UndefSizedVLAChecker.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85996 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03Merge NullDerefChecker.[h,cpp] and UndefDerefChecker.[h,cpp]. They are ↵Ted Kremenek
essentially two parts of the same check. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85911 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03Pull VLA size checker into its own files. Zhongxing Xu
Split it to two checkers, one for undefined size, the other for zero size, so that we don't need to query the size when emitting the bug report. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85895 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03Pull AttrNonNullChecker into its own files.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03Pull UndefinedArgChecker into its own files.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85875 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03Pull BadCallChecker into its own files.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85868 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31Move CheckDivZero into its own files.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31Move UndefDerefChecker into its own file.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30Move NullDerefChecker.h instead a 'Checkers' subdirectory.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85596 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30Move all logic for the null dereference checker from ↵Ted Kremenek
GRExprEngineInternalChecks.cpp to a separate .cpp file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85595 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29Fix accidental use of CheckSVal instead of CheckLocation, and add aTed Kremenek
small test case to show we handle dereferences of undefined values. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29Move NullDeref and UndefDeref into their own checker. Zhongxing Xu
Add a CheckLocation() interface to Checker. Now ImplicitNullDeref nodes are cached in NullDerefChecker. More cleanups follow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85471 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22Rename: CheckBadDiv->CheckDivZero.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84824 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24Shorten the static analyzer diagnostic for 'use of garbage value'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82672 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16Have divide-by-zero checker not handled undefined denominators. This is ↵Ted Kremenek
handled by the generic checking for undefined operands for BinaryOperators. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15Fix static analyzer regression when emitting undefined value warningsTed Kremenek
with binary operators. The result of a binary operator may be undefined even if its operands are well-defined. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81874 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11Introduce "DefinedOrUnknownSVal" into the SVal class hierarchy, providing a wayTed Kremenek
to statically type various methods in SValuator/GRState as required either a defined value or a defined-but-possibly-unknown value. This leads to various logic cleanups in GRExprEngine, and lets the compiler enforce via type checking our assumptions about what symbolic values are possibly undefined and what are not. Along the way, clean up some of the static analyzer diagnostics regarding the uses of uninitialized values. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09Remove tabs, and whitespace cleanups.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03Fix regression introduced in r80786 and reported in PR 4867. We should useTed Kremenek
'dyn_cast' instead of 'cast' as the denominator value could be UnknownVal (and is not guaranteed to be a DefinedVal). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80869 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03remove a debug output I introduced in the last commit.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80865 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02Refactor the check for bad divide into a checker.Zhongxing Xu
Also fix a checker context bug: the Dst set is not always empty initially. Because in GRExprEngine::CheckerVisit(), *CurrSet is used repeatedly. So we removed the Dst.empty() condition in ~CheckerContext() when deciding whether to do autotransision. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02Refactor bad callee check into a Checker.Zhongxing Xu
Now bad callee is checked as a PreVisit to the CallExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80771 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02Still use BadArg bugtype in the checker. This saves us implement ↵Zhongxing Xu
registerInitialVisitors in the BugReport. When all internal bug checking logic are moved to checkers, BuiltinBug will not reference GRExprEngine, and FlushReports() will be not necessary, since all bugs are emitted into the equivalent classes immediately. For now just add a ctor with no arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01Sentence-case bug category.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29Refactor undefined argument checking into a Checker.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80417 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24ConstraintManager::AssumeDual now accepts a 'DefinedSVal' instead of 'SVal' forTed Kremenek
the condition. This eliminates a source of bugs where the client doesn't correctly reason about undefined or unknown values. This fixes PR 4759. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-18Enhance static analyzer diagnostics by introducing a new 'EnhancedBugReporter'Ted Kremenek
which allows custom checks to register callback creator functions for creating BugReporterVisitor objects. This allows various checks to include diagnostics such as 'assuming value is null' with little extra work. Eventually this API should be refactored to be cleaner and more simple. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79302 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-06Last step of template cleanup: merge *BuilderImpl to *Builder.Zhongxing Xu
Some Builders need further cleanup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78301 91177308-0d34-0410-b5e6-96231b3b80d8