Hi,
Attached is a patch to fix Expr::isIntegerConstantExpr() for a simple
"sizeof(int)". This problem is the same as the one I sent before, but it
seems clang has 2 ways to represent the sizeof operator (as a unary operator
and as a sizeof operator) and thus the code/bug is duplicated.
Regards,
Nuno
Index: AST/Expr.cpp
===================================================================
--- AST/Expr.cpp (revision 45071)
+++ AST/Expr.cpp (working copy)
@@ -662,9 +662,10 @@
static_cast<uint32_t>(Ctx.getTypeSize(getType(), Exp->getOperatorLoc())));
// Get information about the size or align.
- if (Exp->isSizeOf())
- Result = Ctx.getTypeSize(Exp->getArgumentType(), Exp->getOperatorLoc());
- else
+ if (Exp->isSizeOf()) {
+ unsigned CharSize =
Ctx.Target.getCharWidth(Ctx.getFullLoc(Exp->getOperatorLoc()));
+ Result = Ctx.getTypeSize(Exp->getArgumentType(), Exp->getOperatorLoc())
/ CharSize;
+ } else
Result = Ctx.getTypeAlign(Exp->getArgumentType(), Exp->getOperatorLoc());
break;
}
_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev