Changeset 1166:c6f39553b702
- Timestamp:
- 03/28/09 21:27:04
(3 years ago)
- Author:
- Frits van Bommel <fvbommel wxs.nl>
- branch:
- default
- Message:
Clean up some suspicious code.
There's no guarantee a constant of integer type is a ConstantInt?, so it's not
safe to just cast<> these to ConstantInt?. (It could be a constant expression,
for example)
The code is shorter this way too :).
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1161 |
r1166 |
|
| 612 | 612 | if (e1type->ty == Tpointer) { |
|---|
| 613 | 613 | Logger::println("add to pointer"); |
|---|
| 614 | | if (r->isConst()) { |
|---|
| 615 | | llvm::ConstantInt* cofs = llvm::cast<llvm::ConstantInt>(r->isConst()->c); |
|---|
| 616 | | if (cofs->isZero()) { |
|---|
| | 614 | if (DConstValue* cv = r->isConst()) { |
|---|
| | 615 | if (cv->c->isNullValue()) { |
|---|
| 617 | 616 | Logger::println("is zero"); |
|---|
| 618 | 617 | return new DImValue(type, l->getRVal()); |
|---|