aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker
AgeCommit message (Collapse)Author
2010-09-03Support pointer arithmetic in SimpleSValuator involving direct constants.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112932 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03Remove bogus assertions.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112931 91177308-0d34-0410-b5e6-96231b3b80d8
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-02Eliminate CXXBindReferenceExpr, which was used in a ton ofDouglas Gregor
well-intentioned but completely unused code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112868 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-02Fixed broken build with GCCTom Care
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112850 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-02update comments.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112796 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-09-02Fixed unused variable warning.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112784 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01Partial fix for PR 8015 (fix is actually by Jordy Rose, and I added a test ↵Ted Kremenek
case for follow-on work). This patch adds a bandaid for RegionStore's limited reasoning about symbolic array values. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112766 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01Don't assert in the analyzer when analyze code does a byte load from a ↵Ted Kremenek
function's address. Fixes PR 8052. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112761 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01Don't assert in CastSizeChecker when the casted-to pointee is an incomplete ↵Ted Kremenek
type. Fixes PR 8050. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112738 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31Add range of return value expression in ReturnUndefChecker. Patch by Jim ↵Ted Kremenek
Goodnow II! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112569 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30Adjusted the semantics of assign checking in IdempotentOperationCheckerTom Care
- 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112501 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30Revert my user-defined literal commits - r1124{58,60,67} pendingSean Hunt
some issues being sorted out. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112493 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29Implement C++0x user-defined string literals.Sean Hunt
The extra data stored on user-defined literal Tokens is stored in extra allocated memory, which is managed by the PreprocessorLexer because there isn't a better place to put it that makes sure it gets deallocated, but only after it's used up. My testing has shown no significant slowdown as a result, but independent testing would be appreciated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112458 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29Add comments.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112414 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Added checking of (x == x) and (x != x) to IdempotentOperationChecker and ↵Tom Care
updated test cases flagged by it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112313 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Enabled relaxed LiveVariables analysis in the path-sensitive engine to ↵Tom Care
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112312 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Remove an assertion in UnreachableCodeChecker that can be triggered by bugs ↵Tom Care
in other checkers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112310 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Fix bug in IdempotentOperationChecker where an assumption would not get ↵Tom Care
updated properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112309 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-26Remove redundant cast<...>.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112229 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26De-memberify the VarDecl and FunctionDecl StorageClass enums.John McCall
This lets us remove Sema.h's dependency on Expr.h and Decl.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112156 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26zap dead ctorChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112132 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall
to the new constants. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24Improvements to IdempotentOperationChecker and its use of PseudoConstantAnalysisTom Care
- 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24Improve comments.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111897 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23Several small changes to PseudoConstantAnalysis and the way ↵Tom Care
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111832 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23Adjust code placement.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111790 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22Detabify.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Place method near its class.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111737 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Remove dead code.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111736 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Improve comments.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111735 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Remove a special case for OSAtomic functions. We can already bind and retrieveZhongxing Xu
with the same binding key. The only trick here is that sometimes the Symbolic region is stored in with an LocAsInteger wrapper. We unwrap that in SVal::getAsLocSymbol(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111734 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Remove dead code. We no longer need it because now we treat the first elementZhongxing Xu
region and its base region as the same binding key. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111732 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21remove unused variable.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21When invalidating a struct region, whether its type definition exists is notZhongxing Xu
relavant any more, because we set its default value to a symbol, and the type of default symbolic value is irrelavant. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111730 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20Remove dead code.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111616 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20Handle nested compound values in BindArray for multidimensional arrays. ↵Jordy Rose
Fixes PR7945. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111602 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19Remove dead code. Patch by Jon Mulder!Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18More PCH -> AST renaming.Sebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111472 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18Generate Attr subclasses with TableGen.Sean Hunt
Now all classes derived from Attr are generated from TableGen. Additionally, Attr* is no longer its own linked list; SmallVectors or Attr* are used. The accompanying LLVM commit contains the updates to TableGen necessary for this. Some other notes about newly-generated attribute classes: - The constructor arguments are a SourceLocation and a Context&, followed by the attributes arguments in the order that they were defined in Attr.td - Every argument in Attr.td has an appropriate accessor named getFoo, and there are sometimes a few extra ones (such as to get the length of a variadic argument). Additionally, specific_attr_iterator has been introduced, which will iterate over an AttrVec, but only over attributes of a certain type. It can be accessed through either Decl::specific_attr_begin/end or the global functions of the same name. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111455 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18Added psuedo-constant analysis and integrated it into the false positive ↵Tom Care
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111426 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18Remove dead malloc symbols from the symbol-state map.Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111353 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18Use RegionStateTy everywhere we mean ImmutableMap<SymbolRef, RefState>Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111351 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18zap dead code.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111347 91177308-0d34-0410-b5e6-96231b3b80d8