summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-08-23 11:27:56 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-08-23 11:27:56 +0000
commit5d14c48dbbeccc01508c118e67cb8abcaf161d76 (patch)
tree8ae0eec4f3270332ff591712684f3c20ef6d0628
parent2ebe619340046058964e94453c81b13e259b8f9f (diff)
downloadbcm5719-llvm-5d14c48dbbeccc01508c118e67cb8abcaf161d76.tar.gz
bcm5719-llvm-5d14c48dbbeccc01508c118e67cb8abcaf161d76.zip
Attempt to fix clang bootstrap (broken by r162425).
llvm-svn: 162440
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 4ea2908c544..b55137094e7 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -1486,13 +1486,33 @@ CodeGenFunction::EmitPointerWithAlignment(const Expr *Addr) {
return Ptr;
} else if (ICE->getCastKind() == CK_ArrayToPointerDecay) {
LValue LV = EmitLValue(ICE->getSubExpr());
- return std::make_pair(LV.getAddress(), LV.getAlignment().getQuantity());
+ unsigned Align = LV.getAlignment().getQuantity();
+ if (!Align) {
+ // FIXME: Once LValues are fixed to always set alignment,
+ // zap this code.
+ QualType PtTy = ICE->getSubExpr()->getType();
+ if (!PtTy->isIncompleteType())
+ Align = getContext().getTypeAlignInChars(PtTy).getQuantity();
+ else
+ Align = 1;
+ }
+ return std::make_pair(LV.getAddress(), Align);
}
}
if (const UnaryOperator *UO = dyn_cast<UnaryOperator>(Addr)) {
if (UO->getOpcode() == UO_AddrOf) {
LValue LV = EmitLValue(UO->getSubExpr());
- return std::make_pair(LV.getAddress(), LV.getAlignment().getQuantity());
+ unsigned Align = LV.getAlignment().getQuantity();
+ if (!Align) {
+ // FIXME: Once LValues are fixed to always set alignment,
+ // zap this code.
+ QualType PtTy = UO->getSubExpr()->getType();
+ if (!PtTy->isIncompleteType())
+ Align = getContext().getTypeAlignInChars(PtTy).getQuantity();
+ else
+ Align = 1;
+ }
+ return std::make_pair(LV.getAddress(), Align);
}
}
OpenPOWER on IntegriCloud