Add support in GRExprEngine for UnaryOperator::AlignOf. This fixes one crash report in PR 2796.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57777 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index d122dca..98fa58f 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1780,6 +1780,23 @@
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: {