summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/constant-folding.c
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer] Convert many existing tests to use clang_analyzer_eval.Jordy Rose2012-05-161-45/+42
| | | | llvm-svn: 156920
* [analyzer] Reduce parallel code paths in SimpleSValBuilder::evalBinOpNN, and ↵Jordy Rose2012-05-061-0/+9
| | | | | | | | | | | | | | handle mixed-type operations more generally. The logical change is that the integers in SymIntExprs may not have the same type as the symbols they are paired with. This was already the case with taint-propagation expressions created by SValBuilder::makeSymExprValNN, but I think those integers may never have been used. SimpleSValBuilder should be able to handle mixed-integer-type SymIntExprs fine now, though, and the constraint managers were already being defensive (though not entirely correct). All existing tests pass. The logic in evalBinOpNN has been simplified so that conversion is done as late as possible. As a result, most of the switch cases have been reduced to do the minimal amount of work, delegating to another case when they can by substituting ConcreteInts and (as before) reversing the left and right arguments when useful. Comparisons require special handling in two places (building SymIntExprs and evaluating constant-constant operations) because we don't /know/ the best type for comparing the two values. I've approximated the rules in Sema [C99 6.3.1.8] but it'd be nice to refactor Sema's actual algorithm into ASTContext. This is also groundwork for handling mixed-type constraints better than we do now. llvm-svn: 156270
* [analyzer] rename all experimental checker packages to have 'experimental' ↵Ted Kremenek2011-08-031-1/+1
| | | | | | be the common root package. llvm-svn: 136835
* Emit a -Wnull-dereference warning for "*null" not just "*null = something". ↵Argyrios Kyrtzidis2011-04-261-1/+1
| | | | | | Addresses rdar://9269271. llvm-svn: 130207
* Rework checker "packages" and groups to be more hierarchical.Ted Kremenek2011-03-241-1/+1
| | | | llvm-svn: 128187
* [analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best ↵Argyrios Kyrtzidis2011-02-281-1/+1
| | | | | | misnomer award. llvm-svn: 126676
* [analyzer] Migrate NSErrorChecker and DereferenceChecker to CheckerV2.Argyrios Kyrtzidis2011-02-281-1/+1
| | | | | | | | They cooperate in that NSErrorChecker listens for ImplicitNullDerefEvent events that DereferenceChecker can dispatch. ImplicitNullDerefEvent is when we dereferenced a location that may be null. llvm-svn: 126659
* [analyzer] Remove '-analyzer-experimental-checks' flag.Argyrios Kyrtzidis2011-02-281-1/+1
| | | | llvm-svn: 126607
* [analyzer] Remove '-analyzer-experimental-internal-checks' flag, it doesn't ↵Argyrios Kyrtzidis2011-02-241-1/+1
| | | | | | have any checkers associated with it anymore. llvm-svn: 126440
* [analyzer] Use the new registration mechanism on some of the experimental ↵Argyrios Kyrtzidis2011-02-151-1/+1
| | | | | | | | | | | | | | | checks. These are: CStringChecker ChrootChecker MallocChecker PthreadLockChecker StreamChecker UnreachableCodeChecker MallocChecker creates implicit dependencies between checkers and needs to be handled differently. llvm-svn: 125598
* Do lvalue-to-rvalue conversions on the LHS of a shift operator.John McCall2010-12-161-1/+0
| | | | | | Fixes rdar://problem/8776586. llvm-svn: 121992
* Start migration of static analyzer to using theTed Kremenek2010-12-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit lvalue-to-rvalue casts that John McCall recently introduced. This causes a whole bunch of logic in the analyzer for handling lvalues to vanish. It does, however, raise a few issues in the analyzer w.r.t to modeling various constructs (e.g., field accesses to compound literals). The .c/.m analysis test cases that fail are due to a missing lvalue-to-rvalue cast that will get introduced into the AST. The .cpp failures were more than I could investigate in one go, and the patch was already getting huge. I have XFAILED some of these tests, and they should obviously be further investigated. Some highlights of this patch include: - CFG no longer requires an lvalue bit for CFGElements - StackFrameContext doesn't need an 'asLValue' flag - The "VisitLValue" path from GRExprEngine has been eliminated. Besides the test case failures (XFAILed), there are surely other bugs that are fallout from this change. llvm-svn: 121960
* Added psuedo-constant analysis and integrated it into the false positive ↵Tom Care2010-08-181-5/+5
| | | | | | | | | | | | | reduction stage in IdempotentOperationChecker. - Renamed IdempotentOperationChecker::isConstant to isConstantOrPseudoConstant to better reflect the function - Changed IdempotentOperationChecker::PreVisitBinaryOperator to only run 'CanVary' once on undefined assumptions - Created new PsuedoConstantAnalysis class and added it to AnalysisContext - Changed IdempotentOperationChecker to exploit the new analysis - Updated tests with psuedo-constants - Added check to IdempotentOperationChecker to see if a Decl is const qualified llvm-svn: 111426
* Added some false positive checking to UnreachableCodeCheckerTom Care2010-07-271-37/+37
| | | | | | | | | - 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
* Finesse 'idempotent operations' analyzer issues to include the opcode of the ↵Ted Kremenek2010-07-271-5/+5
| | | | | | 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
* Improved false positive rate for the idempotent operations checker and moved ↵Tom Care2010-07-161-5/+5
| | | | | | | | | | it into the default path-sensitive analysis options. - Added checks for static local variables, self assigned parameters, and truncating/extending self assignments - Removed command line option (now default with --analyze) - Updated test cases to pass with idempotent operation warnings llvm-svn: 108550
* Pointer comparisons (and pointer-pointer subtraction). Basically filling in ↵Jordy Rose2010-06-281-0/+11
| | | | | | SimpleSValuator::EvalBinOpLL(). llvm-svn: 106992
* Adds analyzer support for idempotent and tautological binary operations such ↵Jordy Rose2010-06-201-0/+61
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
OpenPOWER on IntegriCloud