mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
Add support in GRExprEngine for UnaryOperator::AlignOf. This fixes one crash report in PR 2796.
llvm-svn: 57777
This commit is contained in:
parent
cfb049c832
commit
f8d65a30d6
@ -1780,6 +1780,23 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred,
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case UnaryOperator::AlignOf: {
|
||||||
|
|
||||||
|
QualType T = U->getSubExpr()->getType();
|
||||||
|
|
||||||
|
// FIXME: Add support for VLAs.
|
||||||
|
|
||||||
|
if (!T.getTypePtr()->isConstantSizeType())
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint64_t size = getContext().getTypeAlign(T) / 8;
|
||||||
|
const GRState* St = GetState(Pred);
|
||||||
|
St = SetSVal(St, U, NonLoc::MakeVal(getBasicVals(), size, U->getType()));
|
||||||
|
|
||||||
|
MakeNode(Dst, U, Pred, St);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
case UnaryOperator::SizeOf: {
|
case UnaryOperator::SizeOf: {
|
||||||
|
|
||||||
|
@ -9,3 +9,7 @@
|
|||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
// Reduced test case from crash in PR 2796;
|
||||||
|
// http://llvm.org/bugs/show_bug.cgi?id=2796
|
||||||
|
|
||||||
|
unsigned foo(unsigned x) { return __alignof__((x)) + sizeof(x); }
|
||||||
|
Loading…
Reference in New Issue
Block a user