From: Ted Kremenek Date: Wed, 30 Apr 2008 21:31:12 +0000 (+0000) Subject: Provide SizeOfAlignTypeExpr workaround in the static analyzer for taking the sizeof... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f342d1887c9b2ef24d029c0546d536e2277b9976;p=clang Provide SizeOfAlignTypeExpr workaround in the static analyzer for taking the sizeof of a ObjCInterfaceType. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50499 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index 877bd09a28..7506c80f5e 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -1432,6 +1432,12 @@ void GRExprEngine::VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr* Ex, if (!T.getTypePtr()->isConstantSizeType()) return; + // Some code tries to take the sizeof an ObjCInterfaceType, relying that + // the compiler has laid out its representation. Just report Unknown + // for these. + if (T->isObjCInterfaceType()) + return; + amt = 1; // Handle sizeof(void) if (T != getContext().VoidTy)