summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/idempotent-operations.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Don't flag idempotent '+' or '-' warnings for pointer arithmetic (typically ↵Ted Kremenek2010-10-291-0/+10
| | | | | | | | false positives). Fixes <rdar://problem/8601243>. llvm-svn: 117635
* Disallow the use of UnknownVal as the index for ElementRegions. UnknownVals ↵Ted Kremenek2010-09-151-0/+30
| | | | | | | | | | | | | | | | | can be used as the index when the value evaluation isn't powerful enough. By creating ElementRegions with UnknownVals as the index, this gives the false impression that they are the same element, when they really aren't. This becomes really problematic when deriving symbols from these regions (e.g., those representing the initial value of the index), since two different indices will get the same symbol for their binding. This fixes an issue with the idempotent operations checker that would cause two indices that are clearly not the same to make it appear as if they always had the same value. Fixes <rdar://problem/8431728>. llvm-svn: 113920
* Re-enabled truncation/extension checking in IdempotentOperationChecker and ↵Tom Care2010-09-071-0/+7
| | | | | | added a test case. llvm-svn: 113269
* Adjusted the semantics of assign checking in IdempotentOperationCheckerTom Care2010-08-301-0/+15
| | | | | | | | | | - Fixed a regression where assigning '0' would be reported - Changed the way self assignments are filtered to allow constant testing - Added a test case for assign ops - Fixed one test case where a function pointer was not considered constant - Fixed test cases relating to 0 assignment llvm-svn: 112501
* Enabled relaxed LiveVariables analysis in the path-sensitive engine to ↵Tom Care2010-08-271-0/+14
| | | | | | | | | | | increase the coverage of bugs. Primarily affects IdempotentOperationChecker. - Migrated a temporarily separated test back to its original file (bug has been fixed, null-deref-ps-temp.c -> null-deref-ps.c) - Changed SymbolManager to use relaxed LiveVariables - Updated several test cases that the IdempotentOperationChecker class now flags - Added test case to test relaxed LiveVariables use by the IdempotentOperationChecker llvm-svn: 112312
* Improved the handling of blocks and block variables in PseudoConstantAnalysisTom Care2010-08-251-6/+22
| | | | | | | | | | - Removed the assumption that __block vars are all non-constant - Simplified some repetitive code in RunAnalysis - Added block walking support - Code/comments cleanup - Separated out test for block pseudoconstants llvm-svn: 112098
* Improvements to IdempotentOperationChecker and its use of PseudoConstantAnalysisTom Care2010-08-241-3/+6
| | | | | | | | | | | | - Added wasReferenced function to PseudoConstantAnalysis to determine if a variable was ever referenced in a function (outside of a self-assignment) - BlockDeclRefExpr referenced variables are now explicitly added to the non-constant list - Remove unnecessary ignore of implicit casts - Generalized parameter self-assign detection to detect deliberate self-assigns of variables to avoid unused variable warnings - Updated test cases with deliberate self-assignments - Fixed bug with C++ references and pseudoconstants - Added test case for C++ references and pseudoconstants llvm-svn: 111965
* Modified pseudoconstant test case to make it a bit clearer and fix a missing ↵Tom Care2010-08-231-3/+5
| | | | | | line llvm-svn: 111833
* Several small changes to PseudoConstantAnalysis and the way ↵Tom Care2010-08-231-6/+32
| | | | | | | | | | | | IdempotentOperationChecker uses it. - Psuedo -> Pseudo (doh...) - C++ reference support - Added pseudoconstant test case for __block vars - Separated out static local checking from pseudoconstant analysis and generalized to non-local checking - Added missing test cases for storage false positives llvm-svn: 111832
* Added psuedo-constant analysis and integrated it into the false positive ↵Tom Care2010-08-181-2/+28
| | | | | | | | | | | | | 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 basic psuedoconstant checking in IdempotentOperationChecker and fixed ↵Tom Care2010-08-161-2/+4
| | | | | | some test cases. llvm-svn: 111190
* Improved IdempotentOperationChecker false positives and false negatives.Tom Care2010-08-121-7/+20
| | | | | | | | | - 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
* Removed IdempotentOperationChecker from default analysis and returned back ↵Tom Care2010-08-061-1/+1
| | | | | | | | | 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
* Test case for PR7763.Tom Care2010-07-301-0/+14
| | | | llvm-svn: 109895
* Finesse 'idempotent operations' analyzer issues to include the opcode of the ↵Ted Kremenek2010-07-271-31/+31
| | | | | | 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
* Fix APFloat assertion failure in IdempotentOperationChecker resulting in havingTed Kremenek2010-07-171-0/+6
| | | | | | an APFloat with different "float semantics" than the compared float literal. llvm-svn: 108590
* Improved false positive rate for the idempotent operations checker and moved ↵Tom Care2010-07-161-1/+1
| | | | | | | | | | 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
* Fix idempotent operations test command line arguments.Tom Care2010-07-061-1/+1
| | | | llvm-svn: 107735
* Added a path-sensitive idempotent operation checker ↵Tom Care2010-07-061-0/+52
(-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
OpenPOWER on IntegriCloud