From: Ted Kremenek Date: Thu, 21 Feb 2008 18:15:29 +0000 (+0000) Subject: Added transfer function support for sizeof(void) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=297d0d701dd3baa501930c46dfd7ff9db1295614;p=clang Added transfer function support for sizeof(void) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47443 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp index fb6dc80e0d..1ca37615d8 100644 --- a/Analysis/GRExprEngine.cpp +++ b/Analysis/GRExprEngine.cpp @@ -528,18 +528,22 @@ void GRExprEngine::VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr* Ex, QualType T = Ex->getArgumentType(); // FIXME: Implement alignof - // FIXME: Add support for sizeof(void) - // FIXME: Add support for VLAs. + // FIXME: Add support for VLAs. if (!T.getTypePtr()->isConstantSizeType()) return; - SourceLocation Loc = Ex->getExprLoc(); - uint64_t size = getContext().getTypeSize(T, Loc) / 8; + + uint64_t size = 1; // Handle sizeof(void) + + if (T != getContext().VoidTy) { + SourceLocation Loc = Ex->getExprLoc(); + size = getContext().getTypeSize(T, Loc) / 8; + } Nodify(Dst, Ex, Pred, SetRVal(Pred->getState(), Ex, - NonLVal::MakeVal(ValMgr, size, Ex->getType(), Loc))); + NonLVal::MakeVal(ValMgr, size, Ex->getType()))); }