Ted Kremenek
fd5856adcb
Refactor GRExprEngine::VisitCall() to use EvalArguments(), just like VisitCXXMemberCallExpr(). Ideally we should unify these code paths as much as possible, since they only differ by a few details.
...
llvm-svn: 114628
2010-09-23 05:14:51 +00:00
Tom Care
58191966bc
Refactored BugReporter to refer to EndNode as ErrorNode. We currently make the assumption that EndNode == ErrorNode, but upcoming changes will break this.
...
llvm-svn: 114065
2010-09-16 03:50:38 +00:00
Zhongxing Xu
2cd7a78c76
Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patch
...
and discussions with Ted and Jordy.
llvm-svn: 114056
2010-09-16 01:25:47 +00:00
Tom Care
c88ed9561e
Rename 'MaxLoop' to 'MaxVisit' in AnalysisManager to more correctly reflect that we aborted analysis may not necessarily be due to a loop.
...
llvm-svn: 113862
2010-09-14 21:35:27 +00:00
Sebastian Redl
9ac55dd8e4
Serialization support for CXXNoexceptExpr.
...
llvm-svn: 113627
2010-09-10 20:55:54 +00:00
Ted Kremenek
e495c99055
Implement: <rdar://problem/6351970> rule request: warn if @synchronized mutex can be nil
...
llvm-svn: 113573
2010-09-10 03:05:40 +00:00
Ted Kremenek
ed12f1b9f9
Add ObjCAtSynchronizedStmt to the CFG and add GRExprEngine support (PreVisit for checkers).
...
llvm-svn: 113572
2010-09-10 03:05:33 +00:00
Benjamin Kramer
d4b4b7e8a1
Remove unused variable.
...
llvm-svn: 113482
2010-09-09 12:27:34 +00:00
Ted Kremenek
5f256da834
Rename GRState::getSVal() -> getRawSVal() and getSimplifiedSVal() -> getSVal().
...
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.
llvm-svn: 113477
2010-09-09 07:13:00 +00:00
Ted Kremenek
8f0e834c4c
Static analyzer fix: <rdar://problem/5880430> Switch on enum should not consider default case live if all enum values are covered
...
llvm-svn: 113457
2010-09-09 00:40:40 +00:00
Francois Pichet
5cc0a67f08
Fix warnings caused by new CXXUuidofExprClass enumerator.
...
llvm-svn: 113444
2010-09-08 23:47:05 +00:00
Douglas Gregor
6429f5cf29
Eliminate CXXBindReferenceExpr, which was used in a ton of
...
well-intentioned but completely unused code.
llvm-svn: 112868
2010-09-02 21:50:02 +00:00
Zhongxing Xu
dcf7b3501d
update comments.
...
llvm-svn: 112796
2010-09-02 01:56:39 +00:00
Ted Kremenek
07343c02be
For GRExprEngine::EvalBind() (and called visitors), unifiy StoreE and 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.
...
llvm-svn: 112789
2010-09-02 00:56:20 +00:00
Alexis Hunt
3b7918625c
Revert my user-defined literal commits - r1124{58,60,67} pending
...
some issues being sorted out.
llvm-svn: 112493
2010-08-30 17:47:05 +00:00
Alexis Hunt
79eb5469e0
Implement C++0x user-defined string literals.
...
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.
llvm-svn: 112458
2010-08-29 21:26:48 +00:00
Ted Kremenek
036223bdcf
Fix horrible GRExprEngine bug where switch statements with no 'case:' statements would cause the path to get prematurely aborted. Fixes <rdar://problem/8360854>.
...
llvm-svn: 112233
2010-08-26 22:19:33 +00:00
Ted Kremenek
c8bd967430
Remove redundant cast<...>.
...
llvm-svn: 112229
2010-08-26 22:04:01 +00:00
John McCall
e302792b61
GCC didn't care for my attempt at API compatibility, so brute-force everything
...
to the new constants.
llvm-svn: 112047
2010-08-25 11:45:40 +00:00
Eli Friedman
04831926ec
Detabify.
...
llvm-svn: 111768
2010-08-22 01:00:03 +00:00
Jordy Rose
ac0ab20e3b
Add a callback for when region changes occur. Still somewhat of a work-in-progress, but working! Effect on clients: all changes to a store now go through GRState.
...
llvm-svn: 111078
2010-08-14 20:44:32 +00:00
Jordy Rose
7fa9bf05bc
Add a new metadata symbol type for checkers to use. Metadata symbols must be associated with a region and will be collected if the region dies or its checker fails to mark it as in use.
...
llvm-svn: 111076
2010-08-14 20:18:45 +00:00
Eli Friedman
a2622dd266
Zap unused UnaryOperator::OffsetOf.
...
llvm-svn: 110996
2010-08-13 01:36:11 +00:00
Jordy Rose
2f7ee3ca40
Actually use reduced set of checkers in EvalAssume.
...
llvm-svn: 110904
2010-08-12 04:05:07 +00:00
Zhongxing Xu
8de0a3d8c3
MemRegion can refer to ASTContext without external help.
...
llvm-svn: 110784
2010-08-11 06:10:55 +00:00
Douglas Gregor
8b2d2fe234
Allow reference binding of a reference of Objective-C object type to
...
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.
llvm-svn: 110513
2010-08-07 11:51:51 +00:00
Tom Care
925501c548
Removed IdempotentOperationChecker from default analysis and returned back 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
2010-08-06 22:23:07 +00:00
Zhongxing Xu
44207a9e9f
If all nodes are sunk, bail out early. This make the later check for checkersEvaluated really meaningful.
...
llvm-svn: 110430
2010-08-06 04:20:59 +00:00
Ted Kremenek
9c22219d9c
Revert r110317, and add a comment why the assertion is not an invariant.
...
llvm-svn: 110330
2010-08-05 15:03:30 +00:00
Zhongxing Xu
478fdb16db
Turn the predicate into an assertion. When could the unequal case happen?
...
llvm-svn: 110317
2010-08-05 07:38:23 +00:00
Jordy Rose
c36df4d0b7
Change the checker callback cache in GRExprEngine to be more compact (and 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.
llvm-svn: 110191
2010-08-04 07:10:57 +00:00
Jordy Rose
ddec092641
Makes GRState::makeWithStore private, to encourage clients to make store 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.
llvm-svn: 110137
2010-08-03 20:44:35 +00:00
Tom Care
44081fbc6c
Changed GRExprEngine to pass down a reference to itself when checkers are 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
llvm-svn: 110095
2010-08-03 01:55:07 +00:00
Ted Kremenek
8bedb7dd3f
Teach GRExprEngine::VisitLValue() about FloatingLiteral, ImaginaryLiteral, and CharacterLiteral. Fixes an assertion failure reported in PR 7675.
...
llvm-svn: 109719
2010-07-29 01:31:59 +00:00
Ted Kremenek
1008a2a3d5
Remove extraneous guards around the call to getConjuredSymbolVal(). These checks are already done within getConjuredSymbolVal() itself.
...
llvm-svn: 109707
2010-07-29 00:28:33 +00:00
Zhongxing Xu
692ac46a70
Delete unnecessary const_cast.
...
llvm-svn: 109211
2010-07-23 02:54:53 +00:00
Zhongxing Xu
cabfb72654
AnalysisContext is not const.
...
llvm-svn: 109210
2010-07-23 02:49:07 +00:00
Zhongxing Xu
edb77fe8b4
Constify all references to Stmt* and CFGBlock* in libChecker.
...
llvm-svn: 108811
2010-07-20 06:22:24 +00:00
Zhongxing Xu
c2acbe0f45
Constify.
...
llvm-svn: 108800
2010-07-20 02:41:28 +00:00
Zhongxing Xu
84f65e0692
Reapply r108617.
...
llvm-svn: 108668
2010-07-19 01:31:21 +00:00
Benjamin Kramer
e2e031ed6f
Revert r108617, it broke the build.
...
llvm-svn: 108621
2010-07-17 13:51:58 +00:00
Zhongxing Xu
4ca4a999b1
Prepare the analyzer for the callee in another translation unit:
...
Let AnalysisContext contain a TranslationUnit.
Let CallEnter refer to an AnalysisContext instead of a FunctionDecl.
llvm-svn: 108617
2010-07-17 11:12:42 +00:00
Ted Kremenek
b32964d02d
Fix '<rdar://problem/8202272> __imag passed non-complex should not crash' by removing a bogus assertion.
...
llvm-svn: 108602
2010-07-17 01:28:55 +00:00
Tom Care
826e6b4023
Improved false positive rate for the idempotent operations checker and moved 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
2010-07-16 20:41:41 +00:00
Douglas Gregor
51954276cc
Introduce a new cast kind for an "lvalue bitcast", which handles
...
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.
llvm-svn: 108294
2010-07-13 23:17:26 +00:00
Douglas Gregor
747eb7840a
Reinstate the fix for PR7556. A silly use of isTrivial() was
...
suppressing copies of objects with trivial copy constructors.
llvm-svn: 107857
2010-07-08 06:14:04 +00:00
Douglas Gregor
e182370eda
Revert r107828 and r107827, the fix for PR7556, which seems to be
...
breaking bootstrap on Linux.
llvm-svn: 107837
2010-07-07 23:37:33 +00:00
Douglas Gregor
6df2b8c3ac
Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
...
newly-narrowed scope. No functionality change.
llvm-svn: 107828
2010-07-07 22:43:56 +00:00
Argyrios Kyrtzidis
36ea322579
Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead 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".
llvm-svn: 107768
2010-07-07 11:31:19 +00:00
Jordy Rose
0704a7fe43
Support sizeof for VLA expressions (sizeof(someVLA)). sizeof(int[n]) still unimplemented. A VLA region's sizeof value matches its extent.
...
llvm-svn: 107611
2010-07-05 04:42:43 +00:00