aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2008-11-11 17:56:53 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2008-11-11 17:56:53 +0000
commit0518999d3adcc289997bd974dce90cc97f5c1c44 (patch)
treeb37c751f8fee36d162d7bf009aaa64d22e64910c /lib/Sema/SemaDecl.cpp
parent8f5aab696173cc6e9c9963635d91dc2e83d54442 (diff)
Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof expressions, both of values and types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59057 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index b595ad7f31..fc412a605e 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1470,11 +1470,7 @@ bool Sema::CheckArithmeticConstantExpression(const Expr* Init) {
default:
InitializerElementNotConstant(Init);
return true;
- case UnaryOperator::SizeOf:
- case UnaryOperator::AlignOf:
case UnaryOperator::OffsetOf:
- // sizeof(E) is a constantexpr if and only if E is not evaluted.
- // See C99 6.5.3.4p2 and 6.6p3.
if (Exp->getSubExpr()->getType()->isConstantSizeType())
return false;
InitializerElementNotConstant(Init);
@@ -1487,14 +1483,14 @@ bool Sema::CheckArithmeticConstantExpression(const Expr* Init) {
return CheckArithmeticConstantExpression(Exp->getSubExpr());
}
}
- case Expr::SizeOfAlignOfTypeExprClass: {
- const SizeOfAlignOfTypeExpr *Exp = cast<SizeOfAlignOfTypeExpr>(Init);
+ case Expr::SizeOfAlignOfExprClass: {
+ const SizeOfAlignOfExpr *Exp = cast<SizeOfAlignOfExpr>(Init);
// Special check for void types, which are allowed as an extension
- if (Exp->getArgumentType()->isVoidType())
+ if (Exp->getTypeOfArgument()->isVoidType())
return false;
// alignof always evaluates to a constant.
// FIXME: is sizeof(int[3.0]) a constant expression?
- if (Exp->isSizeOf() && !Exp->getArgumentType()->isConstantSizeType()) {
+ if (Exp->isSizeOf() && !Exp->getTypeOfArgument()->isConstantSizeType()) {
InitializerElementNotConstant(Init);
return true;
}