From 99057462aa001be4327078b5c80e5d3a67a01b3c Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 30 Apr 2008 21:31:12 +0000 Subject: [PATCH] Provide SizeOfAlignTypeExpr workaround in the static analyzer for taking the sizeof of a ObjCInterfaceType. llvm-svn: 50499 --- clang/lib/Analysis/GRExprEngine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp index 877bd09a289c..7506c80f5e73 100644 --- a/clang/lib/Analysis/GRExprEngine.cpp +++ b/clang/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)