forked from OSchip/llvm-project
Fixed another case where sizeof() returns the size in bytes, not bits.
This parallels a previous patch (duplicate logic caused the bug to appear in multiple locations): r44316 (http://llvm.org/viewvc/llvm-project?rev=44316&view=rev). Patch provided by Nuno Lopes. llvm-svn: 45098
This commit is contained in:
parent
557fb1451e
commit
05821322b4
|
@ -662,10 +662,16 @@ bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
|
|||
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());
|
||||
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;
|
||||
}
|
||||
case BinaryOperatorClass: {
|
||||
|
|
Loading…
Reference in New Issue