Ted Kremenek
60983dc3ad
Tighten code and rework indentation of some if() branches (for readability). No functionality change.
...
llvm-svn: 93904
2010-01-19 20:52:05 +00:00
Ted Kremenek
1362b8bbe6
Remove extra space in uses of 'assert()'.
...
llvm-svn: 93903
2010-01-19 20:46:35 +00:00
Ted Kremenek
b27378c82f
Re-alphabetize cases in switch statement.
...
llvm-svn: 93902
2010-01-19 20:40:33 +00:00
Zhongxing Xu
cd17954dbe
Fix a serious bug: Tmp3 is the wrong destination set. We should create a new
...
intermediate destination set Tmp4.
llvm-svn: 93873
2010-01-19 09:25:53 +00:00
Mike Stump
bbf5ba66a9
Add try/catch CFG support. Also improve throw CFG support. WIP.
...
llvm-svn: 93840
2010-01-19 02:20:09 +00:00
Zhongxing Xu
228b0d4def
Add support for computing size in elements for symbolic regions obtained from
...
malloc().
llvm-svn: 93722
2010-01-18 08:54:31 +00:00
Zhongxing Xu
e2bdb9a6e2
If the symbol has not been tracked, do not free it. This is possible when free
...
is called on a pointer that does not get its value directly from malloc.
llvm-svn: 93706
2010-01-18 03:27:34 +00:00
Ted Kremenek
abf6ba1612
Don't suggest the developer use 'arc4random' instead of 'rand' when that function is not available. Fixes PR 6012.
...
llvm-svn: 93508
2010-01-15 08:20:31 +00:00
Ted Kremenek
d74cc397c8
Teach BugReporter to "escape" the occurance of '%' characters in diagnostic messages when emitted results to the standard Diagnostics output. Fixes PR 6033.
...
llvm-svn: 93507
2010-01-15 07:56:51 +00:00
Ted Kremenek
959990b840
Convert a few more uses of std::string& to llvm::StringRef.
...
llvm-svn: 93506
2010-01-15 07:43:59 +00:00
Zhongxing Xu
803ade2532
Fix pr6035.
...
llvm-svn: 93422
2010-01-14 03:45:06 +00:00
Mike Stump
1bacb81d6f
Add an unreachable code checker.
...
llvm-svn: 93287
2010-01-13 02:59:54 +00:00
Benjamin Kramer
378083101c
Fix pasto.
...
llvm-svn: 93181
2010-01-11 20:15:06 +00:00
Benjamin Kramer
0129bd7432
Avoid use of deprecated functions (CStrInCStrNoCase and StringsEqualNoCase).
...
llvm-svn: 93175
2010-01-11 19:46:28 +00:00
Ken Dyck
40775003e6
Roll out ASTContext::getTypeSizeInChars(), replacing instances of
...
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate.
Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType,
fromQuantity(), and getQuantity() for clarity.
llvm-svn: 93153
2010-01-11 17:06:35 +00:00
Zhongxing Xu
e47550e452
Enhance ScanReachableSymbols::scan(). Now another OSAtomic test case passes.
...
The old test case has a little mistake.
llvm-svn: 93148
2010-01-11 07:40:00 +00:00
Zhongxing Xu
cbbf855432
Enhance SVals::getAsRegion: get the region that is converted to an integer.
...
This with previous patch fixes a OSAtomic test case.
llvm-svn: 93146
2010-01-11 06:52:53 +00:00
Ted Kremenek
be909b5eff
Switch RegionStore over to using <BaseRegion+raw offset> to store
...
value bindings. Along with a small change to OSAtomicChecker, this
resolves <rdar://problem/7527292> and resolves some long-standing
issues with how values can be bound to the same physical address by
not have the same "key". This change is only a beginning; logically
RegionStore needs to better handle loads from addresses where the
stored value is larger/smaller/different type than the loaded value.
We handle these cases in an approximate fashion now (via
CastRetrievedVal and help in SimpleSValuator), but it could be made
much smarter.
llvm-svn: 93137
2010-01-11 02:33:26 +00:00
Ted Kremenek
8e994a2808
Preliminary reworking of value-binding logic in RegionStore:
...
(1) Introduce a new 'BindingKey' class to match 'BindingValue'. This
gives us the flexibility to change the current key value from 'const
MemRegion*' to something more interesting.
(2) Rework additions/removals/lookups from the store to use new
'Remove', 'Add', 'Lookup' utility methods.
No "real" functionality change; just prep work and abstraction.
llvm-svn: 93136
2010-01-11 00:07:44 +00:00
Ted Kremenek
c6aa800eb3
Fix overzealous assertion in GRExprEngine::VisitLValue(). A
...
CallExpr/ObjCMessageExpr can be visited in an "lvalue" context if it
returns a struct temporary. Currently the analyzer doesn't reason
about struct temporary returned by function calls, but we shouldn't
crash here either.
llvm-svn: 93081
2010-01-09 22:58:54 +00:00
Ted Kremenek
9aa01441c3
Fix broken diagnostic when returning the address of a stack-allocated array.
...
llvm-svn: 93071
2010-01-09 20:05:00 +00:00
Zhongxing Xu
f1eeb78ffc
When binding an rvalue to a reference, create a temporary object. Use
...
CXXObjectRegion to represent it.
In Environment, lookup a literal expression before make up a value for it.
llvm-svn: 93047
2010-01-09 09:16:47 +00:00
Ted Kremenek
b92304b42f
Fix handling in GRExprEngine of 'default' branch in switch statements
...
when the default case is winnowed down to be infeasible. When all
cases were ruled out (and the analysis state for the default case
would be infeasible) we would still consider the default case
possible. This fixes PR 5969.
llvm-svn: 93017
2010-01-08 18:54:04 +00:00
Zhongxing Xu
662ba69a15
Revert r92318. Instead fix the analyzer: do not call
...
ASTContext::hasSameUnqualifiedType() when one of the type is VariableArrayType.
llvm-svn: 92723
2010-01-05 09:27:03 +00:00
Ted Kremenek
acd71a4562
Make static analysis support for C++ 'this' expression context-sensitive. Essentially treat 'this' as a implicit parameter to the method call, and associate a region with it.
...
llvm-svn: 92675
2010-01-05 02:18:06 +00:00
Ted Kremenek
de8e7447b6
Remove references to 'Checker' and 'GRTransferFuncs' from
...
GRStateManager. Having these references was an abstraction violation,
as they really should only be known about GRExprEngine.
This change required adding a new 'ProcessAssume' callback in
GRSubEngine. GRExprEngine implements this callback by calling
'EvalAssume' on all registered Checker objects as well as the
registered GRTransferFunc object.
llvm-svn: 92549
2010-01-05 00:15:18 +00:00
Zhongxing Xu
b0e15df36b
Let constraint manager inform checkers that some assumption logic has happend.
...
Add new states for symbolic regions tracked by malloc checker. This enables us
to do malloc checking more accurately. See test case.
Based on Lei Zhang's patch and discussion.
llvm-svn: 92342
2009-12-31 06:13:07 +00:00
Zhongxing Xu
7b8b4d70ef
Simplify code by using an equivalent template class.
...
llvm-svn: 92305
2009-12-30 06:38:20 +00:00
Benjamin Kramer
d20ef75b91
Remove some dead variables clang-analyzer found.
...
llvm-svn: 92162
2009-12-25 15:43:36 +00:00
Benjamin Kramer
a713b5d9a8
Fix typo spotted by MSVC.
...
GRExprEngine.cpp(1348) : warning C4305: 'argument' : truncation from 'clang::ProgramPoint::Kind' to 'bool'
llvm-svn: 92154
2009-12-25 09:44:02 +00:00
Zhongxing Xu
51f1ca852f
As Ted suggested, record the callsite information with the StackFrameContext.
...
llvm-svn: 92121
2009-12-24 03:34:38 +00:00
Ted Kremenek
9c951ab4f1
Enhance dataflow analyses to recognize branch statements in the CFG used as hooks for the initialization of condition variables.
...
llvm-svn: 92119
2009-12-24 02:40:30 +00:00
Zhongxing Xu
1704c4331b
Inter-procedural analysis: now we can return from the callee.
...
llvm-svn: 92116
2009-12-24 02:25:21 +00:00
Ted Kremenek
b135a13564
Teach GRExprEngine to handle the initialization of the condition variable of a ForStmt.
...
llvm-svn: 92114
2009-12-24 01:49:25 +00:00
Ted Kremenek
ec92f9492b
Add CFG support for the initializer of the condition variable of a ForStmt.
...
llvm-svn: 92113
2009-12-24 01:49:06 +00:00
Ted Kremenek
1ce53c4320
CFG tweak: in a WhileStmt, the condition variable initializer is evaluated every time the condition is checked.
...
llvm-svn: 92111
2009-12-24 01:34:10 +00:00
Ted Kremenek
09bc3b7df6
Teach GRExprEngine to handle the initialization of the condition variable of a WhileStmt.
...
llvm-svn: 92106
2009-12-24 00:54:56 +00:00
Ted Kremenek
1f07b4c439
Add CFG support for the initializer of the condition variable of a WhileStmt.
...
llvm-svn: 92105
2009-12-24 00:54:37 +00:00
Ted Kremenek
589493227b
Teach GRExprEngine to handle the initialization of the condition variable of a SwitchStmt.
...
llvm-svn: 92102
2009-12-24 00:40:03 +00:00
Ted Kremenek
8b5dc12e52
Add CFG support for the initializer of the condition variable of a SwitchStmt.
...
llvm-svn: 92101
2009-12-24 00:39:26 +00:00
Ted Kremenek
bff9844327
Tidy up FindSubExprAssignments to not deference the child_iterator multiple times.
...
llvm-svn: 92087
2009-12-23 23:37:10 +00:00
Nuno Lopes
cfca1f0dc1
move a few more symbols to .rodata/.data.rel.ro
...
llvm-svn: 92012
2009-12-23 17:49:57 +00:00
Zhongxing Xu
2923046ec4
Migrate the call inliner to the Checker interface.
...
llvm-svn: 91991
2009-12-23 08:56:18 +00:00
Zhongxing Xu
d2ab38e3f4
For inter-procedural analysis, predecessor node may be in another function.
...
So we should use the current program point.
llvm-svn: 91989
2009-12-23 08:54:57 +00:00
Ted Kremenek
a7bcbde814
Add CFG support for the condition variable that can appear in IfStmts in C++ mode.
...
Add transfer function support in GRExprEngine for IfStmts with initialized condition variables.
llvm-svn: 91987
2009-12-23 04:49:01 +00:00
Ted Kremenek
857f41c650
Suppress dead store warnings involving objects initialized with CXXExprTemporaries.
...
llvm-svn: 91986
2009-12-23 04:11:44 +00:00
Ted Kremenek
76d5225271
Add stack trace pretty printing in GRExprEngine::VisitLValue().
...
llvm-svn: 91985
2009-12-23 04:09:43 +00:00
Ted Kremenek
9a05f20d41
Teach GRExprEngine::VisitLValue to ignore CXXExprWithTempories (for now).
...
llvm-svn: 91982
2009-12-23 03:14:23 +00:00
Ted Kremenek
25e280bf02
Fix PR 5857. When casting from a symbolic region to an integer back to a pointer value, we were not correctly layering the correct ElementRegion on the original SymbolicRegion.
...
llvm-svn: 91981
2009-12-23 02:52:14 +00:00
Ted Kremenek
bb7a826844
Teach GRExprEngine::VisitLValue that we don't handle CXXZeroInitValueExprs yet.
...
llvm-svn: 91970
2009-12-23 01:25:13 +00:00