[cfe-commits] r59430 - /cfe/trunk/lib/AST/ExprConstant.cpp
Anders Carlsson
andersca at mac.com
Sun Nov 16 14:46:56 PST 2008
Author: andersca
Date: Sun Nov 16 16:46:56 2008
New Revision: 59430
URL: http://llvm.org/viewvc/llvm-project?rev=59430&view=rev
Log:
Address some comments Eli had.
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=59430&r1=59429&r2=59430&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Sun Nov 16 16:46:56 2008
@@ -407,6 +407,7 @@
bool VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E);
bool VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E) {
+ Result.zextOrTrunc(getIntTypeSizeInBits(E->getType()));
Result = E->getValue();
Result.setIsUnsigned(E->getType()->isUnsignedIntegerType());
return true;
@@ -578,7 +579,9 @@
return false;
APFloat::cmpResult CR = LHS.compare(RHS);
-
+
+ Result.zextOrTrunc(getIntTypeSizeInBits(E->getType()));
+
switch (E->getOpcode()) {
default:
assert(0 && "Invalid binary operator!");
@@ -602,20 +605,12 @@
break;
}
- Result.zextOrTrunc(getIntTypeSizeInBits(E->getType()));
Result.setIsUnsigned(E->getType()->isUnsignedIntegerType());
return true;
}
if (E->getOpcode() == BinaryOperator::Sub) {
- if (LHSTy->isPointerType()) {
- if (RHSTy->isIntegralType()) {
- // pointer - int.
- // FIXME: Implement.
- }
-
- assert(RHSTy->isPointerType() && "RHS not pointer!");
-
+ if (LHSTy->isPointerType() && RHSTy->isPointerType()) {
APValue LHSValue;
if (!EvaluatePointer(E->getLHS(), LHSValue, Info))
return false;
@@ -634,8 +629,8 @@
uint64_t D = LHSValue.getLValueOffset() - RHSValue.getLValueOffset();
D /= Info.Ctx.getTypeSize(ElementType) / 8;
- Result = D;
Result.zextOrTrunc(getIntTypeSizeInBits(E->getType()));
+ Result = D;
Result.setIsUnsigned(E->getType()->isUnsignedIntegerType());
return true;
More information about the cfe-commits
mailing list