Zhongxing Xu
70b27e6f8b
Stop tracking non-compound value for struct. It may be caused by imprecise cast
...
logic.
llvm-svn: 73279
2009-06-13 01:31:11 +00:00
Zhongxing Xu
2693c504c2
use getAsPointerType() method.
...
llvm-svn: 73218
2009-06-12 03:59:12 +00:00
Zhongxing Xu
519a47d4bd
Bind the mistakenly generated nonloc::SymbolVal to struct correctly. See the
...
comments for added test case for details.
llvm-svn: 73189
2009-06-11 09:11:27 +00:00
Zhongxing Xu
d85a991253
Use more robust getAsRecordType() method.
...
llvm-svn: 73186
2009-06-11 07:27:30 +00:00
Zhongxing Xu
1075cc0b02
Treat AllocaRegion as SymbolicRegion in RegionStore::Retrieve().
...
llvm-svn: 72166
2009-05-20 09:18:48 +00:00
Zhongxing Xu
a7907608fb
* API change: we need to pass GRState to GRExprEngine::EvalBinOp() because
...
RegionStore needs to know the type of alloca region.
* RegionStoreManager::EvalBinOp() now converts the alloca region to its first
element region, as what is done to symbolic region.
llvm-svn: 72164
2009-05-20 09:00:16 +00:00
Daniel Dunbar
29f36b4c9a
Silence a Release-Asserts warning.
...
llvm-svn: 72013
2009-05-18 16:48:48 +00:00
Zhongxing Xu
08a2ede018
Add logic for invalidating array region to CFRefCount.cpp. When invalidating
...
array region, set its default value to conjured symbol. When retrieving its
element, create new region value symbol for the element.
Also fix some 80 columns violations.
llvm-svn: 71548
2009-05-12 10:10:00 +00:00
Zhongxing Xu
c012656266
When retrieving an ElementRegion, if its super region is a StringRegion,
...
retrieve the string value.
llvm-svn: 71430
2009-05-11 14:23:36 +00:00
Zhongxing Xu
bf938d3160
Fix a bug that leads to infinite loop. Set the correct element type to
...
ElementRegion.
llvm-svn: 71428
2009-05-11 12:48:56 +00:00
Zhongxing Xu
c9c3dab491
When casting VarRegion, if the var type is aggregate type and the cast-to
...
pointee type is scalar type, create element region regardless with the sizes
of types.
llvm-svn: 71360
2009-05-09 15:34:29 +00:00
Zhongxing Xu
4131114d99
Remove the rest TypedViewRegion processing code. There should be no
...
TypedViewRegion usage in region store.
llvm-svn: 71359
2009-05-09 15:23:42 +00:00
Zhongxing Xu
d6daef9165
When evaluating pointer arithmetic, if the base location is a symbolic region,
...
convert it to the first element region.
Also do not assume the array region is typed.
llvm-svn: 71358
2009-05-09 15:18:12 +00:00
Zhongxing Xu
b18d7cab0c
Do not create a TypedViewRegion when the base struct region is a symbolic
...
region. In the future we may set the cast-to type as the same time. But for
now, we simply leave it as it is.
llvm-svn: 71357
2009-05-09 13:36:16 +00:00
Zhongxing Xu
7c3826484e
Do not layer a TypedViewRegion when casting symbolic or alloca regions.
...
Modify getLValueElement accordingly. Now we don't require base region
to be a typed region. Do not create TypedViewRegion when base region is
symbolic or alloca region. We can do so because each element region has
its type information.
llvm-svn: 71355
2009-05-09 13:20:07 +00:00
Zhongxing Xu
e3e94bbf19
Remove the case for casting to compatible type in
...
RegionStoreManager::CastRegion(). This case should be subsumed by others.
llvm-svn: 71353
2009-05-09 10:03:08 +00:00
Zhongxing Xu
91e2ab496f
Rename:
...
SymbolRegionRValue => SymbolRegionValue
SymExpr::RegionRValue => SymExpr::RegionValueKind
llvm-svn: 71322
2009-05-09 04:08:27 +00:00
Zhongxing Xu
34d04b3ca9
As discussed with Ted, rename TypedRegion::getObjectType() to
...
TypedRegion::getValueType().
llvm-svn: 71321
2009-05-09 03:57:34 +00:00
Zhongxing Xu
8038f7b30f
rename: MemRegion:
...
RValueType => ObjectType
LValueType => LocationType
No functionality change.
llvm-svn: 71304
2009-05-09 00:50:33 +00:00
Zhongxing Xu
ca143e73ea
Fix PR4182.
...
llvm-svn: 71288
2009-05-08 23:28:07 +00:00
Zhongxing Xu
d2e8fa14df
Region store: when casting VarRegions, if the cast-to pointee type is
...
incomplete, do not compute its size and return the original region.
llvm-svn: 71213
2009-05-08 07:28:25 +00:00
Zhongxing Xu
afc875c766
Replace the heuristic isSmallerThan with ASTContext::getTypeSize().
...
llvm-svn: 71206
2009-05-08 02:12:59 +00:00
Zhongxing Xu
c0c074655d
Replace getTypeWidth() with ASTContext::getTypeSize().
...
llvm-svn: 71205
2009-05-08 02:00:55 +00:00
Zhongxing Xu
1ba79dfeea
Revert r71079.
...
llvm-svn: 71202
2009-05-08 01:33:18 +00:00
Zhongxing Xu
ea8c48d5a1
Improve RegionStoreManager::getSizeInElements()
...
- add a static function getTypeWidth(), which computes the width of a type
with the help of TargetInfo.
- no-outofbounds.c now passes for region store.
llvm-svn: 71080
2009-05-06 11:51:48 +00:00
Zhongxing Xu
c98868136f
Add a GDM for recording the cast type of regions.
...
llvm-svn: 71076
2009-05-06 08:33:50 +00:00
Zhongxing Xu
1813e23a52
Implement a heuristic type size comparison method for now.
...
llvm-svn: 71074
2009-05-06 08:08:27 +00:00
Zhongxing Xu
b2d4a52e3f
remove commented code.
...
llvm-svn: 71060
2009-05-06 02:54:11 +00:00
Zhongxing Xu
d5e09be293
Make StoreManager::CastRegion() virtual and implement a new CastRegion() for
...
RegionStore.
This CastRegion() performs casts according to the kind of the region being
cast instead of the type that is cast to.
llvm-svn: 71058
2009-05-06 02:42:32 +00:00
Ted Kremenek
02e508960c
Per conversations with Zhongxing, add an 'element type' to
...
ElementRegion. I also removed 'ElementRegion::getArrayRegion',
although we may need to add this back.
This breaks a few test cases with RegionStore:
- 'array-struct.c' triggers an infinite recursion in RegionStoreManager. Need to investigate.
- misc-ps.m triggers a failure with RegionStoreManager as we now get the diagnostic:
'Line 159: Uninitialized or undefined return value returned to caller.'
There were a bunch of places that needed to be edit
RegionStoreManager, and we may not be passing all the correct 'element
types' down from GRExprEngine.
Zhongxing: When you get a chance, could you review this? I could have
easily screwed up something basic in RegionStoreManager.
llvm-svn: 70830
2009-05-04 06:18:28 +00:00
Zhongxing Xu
3e3e69bbe7
region store: make Retrieve() can retrieve embedded array correctly. Also
...
simplify the retrieve logic.
llvm-svn: 70651
2009-05-03 00:27:40 +00:00
Zhongxing Xu
f985648e83
SymbolicRegions may also be live roots.
...
llvm-svn: 70380
2009-04-29 09:24:35 +00:00
Ted Kremenek
2d495a6f43
Refactor 'BasicStoreManager::CastRegion' and 'RegionStoreManager::CastRegion'
...
into StoreManager::CastRegion. Both methods were practically identical, and this
is core logic that is common to all StoreManagers since it defines the basic
invariants of the abstract memory model.
llvm-svn: 69730
2009-04-21 21:51:34 +00:00
Zhongxing Xu
3070210377
Remove loc::FuncVal.
...
llvm-svn: 69577
2009-04-20 06:35:22 +00:00
Zhongxing Xu
dadf250598
Finally nuke loc::SymbolVal.
...
llvm-svn: 68771
2009-04-10 06:06:13 +00:00
Ted Kremenek
f2489ea043
- Move ownership of MemRegionManager into ValueManager.
...
- Pull SVal::GetConjuredSymbol() and friends into ValueManager. This greatly
simplifies the calling interface to clients.
llvm-svn: 68731
2009-04-09 22:22:44 +00:00
Douglas Gregor
bcced4ec31
Propagate the ASTContext to various AST traversal and lookup functions.
...
No functionality change (really).
llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Zhongxing Xu
ec7e7dfe0a
This is the first step to gradually remove the use of loc::SymbolVal. Now
...
when creating symbolic values, we distinguish between location and non-location
values. For location values, we create a symbolic region instead of a
loc::SymbolVal.
llvm-svn: 68373
2009-04-03 07:33:13 +00:00
Ted Kremenek
7857bd2743
Re-apply 68028. The code had drifted enough that the tests would fail without
...
it. Will discuss offline whether symbolic regions should by typed or typeless.
llvm-svn: 68070
2009-03-30 22:20:54 +00:00
Ted Kremenek
5715393da2
Revert 68028.
...
llvm-svn: 68068
2009-03-30 21:56:17 +00:00
Zhongxing Xu
5415b207e3
Make SymbolicRegion untyped.
...
Layer the type information with a TypedViewRegion on top of the SymbolicRegion.
llvm-svn: 68028
2009-03-30 06:48:56 +00:00
Zhongxing Xu
a865b79f87
Implement a FIXME.
...
llvm-svn: 68024
2009-03-30 05:55:46 +00:00
Zhongxing Xu
17e28b7a54
remove dead code.
...
llvm-svn: 67825
2009-03-27 05:31:12 +00:00
Ted Kremenek
3e31c26f81
analyzer infrastructure: make a bunch of changes to symbolic expressions that
...
Zhongxing and I discussed by email.
Main changes:
- Removed SymIntConstraintVal and SymIntConstraint
- Added SymExpr as a parent class to SymbolData, SymSymExpr, SymIntExpr
- Added nonloc::SymExprVal to wrap SymExpr
- SymbolRef is now just a typedef of 'const SymbolData*'
- Bunch of minor code cleanups in how some methods were invoked (no functionality change)
This changes are part of a long-term plan to have full symbolic expression
trees. This will be useful for lazily evaluating complicated expressions.
llvm-svn: 67731
2009-03-26 03:35:11 +00:00
Zhongxing Xu
17299e6172
Use a work list to recursively build up the subregion mapping, and mark live
...
var region roots.
llvm-svn: 67152
2009-03-18 01:54:31 +00:00
Ted Kremenek
0bf152ef0b
Updated comment.
...
llvm-svn: 66894
2009-03-13 15:39:16 +00:00
Ted Kremenek
ec94f08dce
Fix failure reported by Sebastian of test/Analysis/ptr-arith.c when the target
...
is 64-bit. I used his suggestion of doing a direct bitwidth/signedness
conversion of the 'offset' instead of just changing the sign. For more
information, see:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2009-March/004587.html
llvm-svn: 66892
2009-03-13 15:35:24 +00:00
Zhongxing Xu
5a6fee9fb8
Use getAsRecordType() to get around sugar types.
...
llvm-svn: 66768
2009-03-12 03:45:35 +00:00
Zhongxing Xu
d2e89ae055
Do not stipulate the record type is a definition in BindStruct().
...
llvm-svn: 66654
2009-03-11 09:07:35 +00:00
Zhongxing Xu
507202ecb7
Fix crash when LHS of pointer arithmetic is not ElementRegion.
...
llvm-svn: 66649
2009-03-11 07:43:49 +00:00