summaryrefslogtreecommitdiffstats
path: root/clang/AST/Expr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/AST/Expr.cpp')
-rw-r--r--clang/AST/Expr.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/AST/Expr.cpp b/clang/AST/Expr.cpp
index b8c564e94e1..0410e284a72 100644
--- a/clang/AST/Expr.cpp
+++ b/clang/AST/Expr.cpp
@@ -784,16 +784,18 @@ bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
if (Exp->getArgumentType()->isFunctionType()) {
// GCC extension: sizeof(function) = 1.
Result = Exp->isSizeOf() ? 1 : 4;
- } else if (Exp->isSizeOf()) {
+ } else {
unsigned CharSize =
Ctx.Target.getCharWidth(Ctx.getFullLoc(Exp->getOperatorLoc()));
- Result = Ctx.getTypeSize(Exp->getArgumentType(),
- Exp->getOperatorLoc()) / CharSize;
+ if (Exp->isSizeOf())
+ Result = Ctx.getTypeSize(Exp->getArgumentType(),
+ Exp->getOperatorLoc()) / CharSize;
+ else
+ Result = Ctx.getTypeAlign(Exp->getArgumentType(),
+ Exp->getOperatorLoc()) / CharSize;
}
- else
- Result = Ctx.getTypeAlign(Exp->getArgumentType(), Exp->getOperatorLoc());
-
+
break;
}
case BinaryOperatorClass: {
OpenPOWER on IntegriCloud