Zhongxing Xu
ce83656f97
Limit the use of BindDefault().
...
llvm-svn: 105265
2010-06-01 04:49:26 +00:00
Zhongxing Xu
527ff6d1dc
Add support for calloc() in MallocChecker. Patch by Jordy Rose, with my
...
modification.
llvm-svn: 105264
2010-06-01 03:01:33 +00:00
Ted Kremenek
4708f5a89b
After conversations with Zhongxing Xu and Jordy Rose, refine the logic in
...
RegionStoreManager::RetrieveElement() that handles indexing into a larger scalar
object to only consult the direct binding of a super region if it is a scalar.
This isn't perfect yet, and a big FIXME is attached to the code. This causes
the test case for PR 7218 now to pass.
llvm-svn: 105195
2010-05-31 01:22:04 +00:00
Zhongxing Xu
94aec9381d
Revert r105097. Thinking about a better fix.
...
llvm-svn: 105099
2010-05-29 06:49:04 +00:00
Zhongxing Xu
928a190a8e
Fix PR7218. Patch by Jordy Rose.
...
llvm-svn: 105097
2010-05-29 06:23:24 +00:00
Zhongxing Xu
eb4fc4a64c
Small fix.
...
llvm-svn: 104669
2010-05-26 03:36:08 +00:00
Zhongxing Xu
d4f1294f1e
Remove extents of dead symbolic regions when RemoveDeadBindings.
...
This requires creating new persistent states due to the nature of GDM.
llvm-svn: 104668
2010-05-26 03:27:35 +00:00
Zhongxing Xu
658dd8b176
CastSizeChecker checks when casting a malloc'ed symbolic region to type T,
...
whether the size of the symbolic region is a multiple of the size of T.
Fixes PR6123 and PR7217.
llvm-svn: 104584
2010-05-25 04:59:19 +00:00
Douglas Gregor
8385a06929
Introduce Type::isStructureOrClassType(), which does the obvious
...
thing. Audit all uses of Type::isStructure(), changing those calls to
isStructureOrClassType() as needed (which is alsmost
everywhere). Fixes the remaining failure in Boost.Utility/Swap.
llvm-svn: 102386
2010-04-26 21:31:17 +00:00
Zhongxing Xu
b6843f5f35
Analyzer: add support for CXXNewExpr.
...
llvm-svn: 101771
2010-04-19 11:47:28 +00:00
Ted Kremenek
26984fb4eb
Remove copy of 'Optional' in Clang tree, and convert clients to use the one now in the LLVM tree.
...
llvm-svn: 100891
2010-04-09 20:26:58 +00:00
Zhongxing Xu
640aad7667
Use the element type to compute the array size when the base region is a VarRegion.
...
Patch by Jordy Rose.
llvm-svn: 100099
2010-04-01 08:20:27 +00:00
Ted Kremenek
c3e1f2f9ba
Fix a bug (PR 6699) in RegionStore::RemoveDeadBindings() where
...
array values with a non-zero offset would get prematurely pruned from the store.
llvm-svn: 100067
2010-04-01 00:15:55 +00:00
Ted Kremenek
2d107f9d1d
RegionStore: specially handle loads from integer global variables declared 'const'.
...
Fixes a false positive reported in PR 6288.
llvm-svn: 99922
2010-03-30 20:31:04 +00:00
Ted Kremenek
f7c226da00
Use 'const Optional<SVal>&' to avoid an extra copy.
...
llvm-svn: 99921
2010-03-30 20:30:52 +00:00
Zhongxing Xu
e248dca300
Bind the constructed object value to CXXConstructExpr.
...
llvm-svn: 99271
2010-03-23 09:13:17 +00:00
Zhongxing Xu
03fd76663e
Mark CXXThisRegion in the current or parent stack frame context as live so that
...
their bindings are not removed.
llvm-svn: 98705
2010-03-17 03:35:08 +00:00
Zhongxing Xu
0eb690390d
Add VisitCXXContructExpr logic to the analyzer. This still has not fully worked
...
since RemoveDeadBinding mistakenly remove the binding to CXXThisRegion.
llvm-svn: 98629
2010-03-16 13:14:16 +00:00
Ted Kremenek
1794ec4a30
Simplify assertion.
...
llvm-svn: 98176
2010-03-10 19:09:37 +00:00
Ted Kremenek
fe697ebaaf
Remove '#if 0' code. Lazy compound values have proven their worth.
...
llvm-svn: 98175
2010-03-10 19:09:34 +00:00
Ted Kremenek
9e92d3f99d
Remove the subregion map cache. It is no longer used.
...
llvm-svn: 98161
2010-03-10 16:38:44 +00:00
Ted Kremenek
2ce82b2323
Fix stale comment.
...
llvm-svn: 98160
2010-03-10 16:38:41 +00:00
Ted Kremenek
ddce4a3d0f
Really apply (unnoticed weird git-svn merge conflict in 98144): Refactor RegionStore::RemoveDeadBindings to use the same core cluster analysis algorithm as RegionStore::InvalidateRegions().
...
Beyond simplifying the algorithm significantly, we no longer
need to build subregion maps in RemoveDeadBindings(). This
and other changes cause a significant speedup: the time to
analyze sqlite3.c (single core) drops by 14%.
llvm-svn: 98159
2010-03-10 16:32:56 +00:00
Ted Kremenek
ba2e6c6b73
Refactor RegionStore::RemoveDeadBindings to use the same core
...
cluster analysis algorithm as RegionStore::InvalidateRegions().
Beyond simplifying the algorithm significantly, we no longer
need to build subregion maps in RemoveDeadBindings(). This
and other changes cause a significant speedup: the time to
analyze sqlite3.c (single core) drops by 14%.
llvm-svn: 98144
2010-03-10 07:20:03 +00:00
Ted Kremenek
a2536b642c
Refactor some of RegionStore's InvalidateRegionsWorker class
...
into a 'ClusterAnalysis' parent class. The idea is
to potentially reuse this for reworking RemoveDeadBindings.
llvm-svn: 98143
2010-03-10 07:19:59 +00:00
Zhongxing Xu
6d3cc382df
Since now we store the cast type with an ElementRegion, there is
...
no need to store a type with SymbolRegionValue.
llvm-svn: 97437
2010-03-01 06:56:52 +00:00
Zhongxing Xu
b0e5c27113
Assert when loading from a code text region instead of returning an unknown silently.
...
llvm-svn: 97436
2010-03-01 05:29:02 +00:00
Ted Kremenek
1a6672a3d4
Enhance RegionStore::InvalidateRegions() to correctly invalidate bindings
...
by scanning through the values of LazyCompoundVals.
llvm-svn: 96067
2010-02-13 01:52:33 +00:00
Ted Kremenek
7950b78430
Pull logic for visiting value bindings in InvalidateRegionsWorker into a separate method.
...
No functionality change.
llvm-svn: 96060
2010-02-13 00:54:03 +00:00
Douglas Gregor
0a5a2216e2
Eliminate the ASTContext parameter from RecordDecl::getDefinition()
...
and CXXRecordDecl::getDefinition(); it's totally unnecessary. No
functionality change.
llvm-svn: 95836
2010-02-11 01:04:33 +00:00
Zhongxing Xu
bc1d4ae206
Add comment.
...
llvm-svn: 95755
2010-02-10 02:02:10 +00:00
Ted Kremenek
499b4e3387
Fix lookup of fields from lazy bindings to check if the region is
...
NULL, not the store, to determine if a lookup succeeded. The store
can be null if it contained no bindings. This fixes a false positive
reported to me by a user of the analyzer.
llvm-svn: 95679
2010-02-09 19:11:53 +00:00
Ted Kremenek
57f0989c16
Revert 95541.
...
llvm-svn: 95545
2010-02-08 16:18:51 +00:00
Zhongxing Xu
500f49fe25
Rename: GRState::getSVal(Stmt*) => getExprVal(),
...
GRState::getSVal(MemRegion*) => Load().
llvm-svn: 95541
2010-02-08 09:30:02 +00:00
Zhongxing Xu
8ca2dc05a3
Like for symbolic region, automatically create a element zero region for
...
alloca region.
llvm-svn: 95539
2010-02-08 08:43:02 +00:00
Zhongxing Xu
b02d4a0d11
Unify the implementation of getLValueElement of store managers.
...
It's more sophisticated than the original one of BasicStore. But it does
matter.
llvm-svn: 95536
2010-02-08 08:17:02 +00:00
Zhongxing Xu
f7f0cdc517
Unify the implementation of getLValueIvar and getLValueField of store managers.
...
llvm-svn: 95535
2010-02-08 07:58:06 +00:00
Zhongxing Xu
08515a5242
Move common methods to the base StoreManager class.
...
llvm-svn: 95534
2010-02-08 07:10:35 +00:00
Ted Kremenek
bdfcacbe8f
Also teach RegionStore::RetrieveVar() to handle 'static' pointers that are implicitly initialized to NULL.
...
llvm-svn: 95479
2010-02-06 04:04:46 +00:00
Ted Kremenek
30fe9ecac2
Fix regression in RegionStore (from BasicStore) where static variables were not treated as being implicitly initialized to 0 (and instead were getting symbolicated).
...
llvm-svn: 95478
2010-02-06 03:57:59 +00:00
Ted Kremenek
5abd69d946
Teach RegionStore::InvalidateRegions() to also invalidate static variables referenced by blocks.
...
llvm-svn: 95459
2010-02-06 00:30:00 +00:00
Zhongxing Xu
ad0ef84040
More GRState* -> Store changes.
...
llvm-svn: 95365
2010-02-05 05:34:29 +00:00
Zhongxing Xu
0d081f373a
Remove unused parameter.
...
llvm-svn: 95364
2010-02-05 05:24:20 +00:00
Zhongxing Xu
f668204a6a
More GRState* -> Store changes.
...
llvm-svn: 95362
2010-02-05 05:18:47 +00:00
Zhongxing Xu
7fcd8acbf8
More GRState* -> Store changes.
...
llvm-svn: 95360
2010-02-05 05:06:13 +00:00
Zhongxing Xu
c7b9f950d7
More GRState* -> Store changes.
...
llvm-svn: 95357
2010-02-05 03:01:53 +00:00
Zhongxing Xu
bd96bf1e78
Change LazyCompoundVal to a <Store, MemRegion*> pair. We really don't need to
...
spread GRState* everywhere.
llvm-svn: 95354
2010-02-05 02:26:30 +00:00
Zhongxing Xu
319deb83d2
Cast evaluation no longer touch GRState.
...
llvm-svn: 95290
2010-02-04 04:56:43 +00:00
Ted Kremenek
33617e055a
Remove stray typo.
...
llvm-svn: 95286
2010-02-04 04:14:49 +00:00
Zhongxing Xu
4f8b9899bb
Now that CastRetrievedVal returns SVal, there is no need to use CastResult.
...
llvm-svn: 95279
2010-02-04 02:39:47 +00:00