[cfe-commits] r47259 - /cfe/trunk/AST/Expr.cpp
Anders Carlsson
andersca at mac.com
Sun Feb 17 23:10:46 PST 2008
Author: andersca
Date: Mon Feb 18 01:10:45 2008
New Revision: 47259
URL: http://llvm.org/viewvc/llvm-project?rev=47259&view=rev
Log:
Fix bug where we would report the wrong value for __alignof__ with an expr that is not a type.
Modified:
cfe/trunk/AST/Expr.cpp
Modified: cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Expr.cpp?rev=47259&r1=47258&r2=47259&view=diff
==============================================================================
--- cfe/trunk/AST/Expr.cpp (original)
+++ cfe/trunk/AST/Expr.cpp Mon Feb 18 01:10:45 2008
@@ -736,15 +736,16 @@
if (Exp->getSubExpr()->getType()->isFunctionType()) {
// GCC extension: sizeof(function) = 1.
Result = Exp->getOpcode() == UnaryOperator::AlignOf ? 4 : 1;
- } else if (Exp->getOpcode() == UnaryOperator::AlignOf) {
- Result = Ctx.getTypeAlign(Exp->getSubExpr()->getType(),
- Exp->getOperatorLoc());
} else {
unsigned CharSize =
Ctx.Target.getCharWidth(Ctx.getFullLoc(Exp->getOperatorLoc()));
- Result = Ctx.getTypeSize(Exp->getSubExpr()->getType(),
- Exp->getOperatorLoc()) / CharSize;
+ if (Exp->getOpcode() == UnaryOperator::AlignOf)
+ Result = Ctx.getTypeAlign(Exp->getSubExpr()->getType(),
+ Exp->getOperatorLoc()) / CharSize;
+ else
+ Result = Ctx.getTypeSize(Exp->getSubExpr()->getType(),
+ Exp->getOperatorLoc()) / CharSize;
}
break;
case UnaryOperator::LNot: {
More information about the cfe-commits
mailing list