mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
Attempt to fix clang bootstrap (broken by r162425).
llvm-svn: 162440
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user