aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/GRExprEngine.cpp
AgeCommit message (Collapse)Author
2010-09-10Serialization support for CXXNoexceptExpr.Sebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113627 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10Implement: <rdar://problem/6351970> rule request: warn if @synchronized ↵Ted Kremenek
mutex can be nil git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113573 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10Add ObjCAtSynchronizedStmt to the CFG and add GRExprEngine support (PreVisit ↵Ted Kremenek
for checkers). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113572 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09Remove unused variable.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113482 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09Rename GRState::getSVal() -> getRawSVal() and getSimplifiedSVal() -> getSVal().Ted Kremenek
The end result is now we eagarly constant-fold symbols in the analyzer that are perfectly constrained to be a constant value. This allows us to recover some path-sensitivity in some cases by lowering the required level of reasoning power needed to evaluate some expressions. The net win from this change is that the false positive in PR 8015 is fixed, and we also find more idempotent operations bugs. We do, however, regress with the BugReporterVisitors, which need to be modified to understand this constant folding (and look past it). This causes some diagnostic regressions in plist-output.m which will get addressed in a future patch. plist-output.m is now marked XFAIL, while plist-output-alternate.m now tests that the plist output is working, but with the suboptimal diagnostics. This second test file will eventually be removed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113477 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09Static analyzer fix: <rdar://problem/5880430> Switch on enum should not ↵Ted Kremenek
consider default case live if all enum values are covered git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113457 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08Fix warnings caused by new CXXUuidofExprClass enumerator.Francois Pichet
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113444 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-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-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-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-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-22Detabify.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111768 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-13Zap unused UnaryOperator::OffsetOf.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12Actually use reduced set of checkers in EvalAssume.Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110904 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-07Allow reference binding of a reference of Objective-C object type toDouglas Gregor
an lvalue of another, compatible Objective-C object type (e.g., a subclass). Introduce a new initialization sequence step kind to describe this binding, along with a new cast kind. Fixes PR7741. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110513 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06Removed IdempotentOperationChecker from default analysis and returned back ↵Tom Care
to a flag (-analyzer-check-idempotent-operations) - Added IdempotentOperationChecker to experimental analyses for testing purposes - Updated test cases to explictly call the checker git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110482 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06If all nodes are sunk, bail out early. This make the later check for ↵Zhongxing Xu
checkersEvaluated really meaningful. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110430 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Revert r110317, and add a comment why the assertion is not an invariant.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110330 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Turn the predicate into an assertion. When could the unequal case happen?Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110317 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-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-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-07-29Teach GRExprEngine::VisitLValue() about FloatingLiteral, ImaginaryLiteral, ↵Ted Kremenek
and CharacterLiteral. Fixes an assertion failure reported in PR 7675. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109719 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29Remove extraneous guards around the call to getConjuredSymbolVal(). These ↵Ted Kremenek
checks are already done within getConjuredSymbolVal() itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23Delete unnecessary const_cast.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109211 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-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-17Fix '<rdar://problem/8202272> __imag passed non-complex should not crash' by ↵Ted Kremenek
removing a bogus assertion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108602 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16Improved false positive rate for the idempotent operations checker and moved ↵Tom Care
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108550 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13Introduce a new cast kind for an "lvalue bitcast", which handlesDouglas Gregor
reinterpret_casts (possibly indirectly via C-style/functional casts) on values, e.g., int i; reinterpret_cast<short&>(i); The IR generated for this is essentially the same as for *reinterpret_cast<short*>(&i). Fixes PR6437, PR7593, and PR7344. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108294 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08Reinstate the fix for PR7556. A silly use of isTrivial() wasDouglas Gregor
suppressing copies of objects with trivial copy constructors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07Revert r107828 and r107827, the fix for PR7556, which seems to beDouglas Gregor
breaking bootstrap on Linux. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107837 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect itsDouglas Gregor
newly-narrowed scope. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead ↵Argyrios Kyrtzidis
of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH. Makes de-serialization of the function body even more "lazier". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-05Support sizeof for VLA expressions (sizeof(someVLA)). sizeof(int[n]) still ↵Jordy Rose
unimplemented. A VLA region's sizeof value matches its extent. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107611 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-30Correctly implement the CheckerVisit optimization introduced in r106884, but ↵Ted Kremenek
this time actually used the cached checker list when calling back to Checker visit methods. This reduces the analysis time for sqlite3.c by 8%. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107259 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26Allow '__extension__' to be analyzed in a lvalue context.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106964 91177308-0d34-0410-b5e6-96231b3b80d8