From: Ted Kremenek Date: Tue, 30 Mar 2010 18:24:54 +0000 (+0000) Subject: Change the analyzer to recognize (but ignore) assignments to isa. Fixes PR 6302. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8891c4277a2e5b729214165414dcfe929b06e9b0;p=clang Change the analyzer to recognize (but ignore) assignments to isa. Fixes PR 6302. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99904 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp index ae4c5fe3c1..1afe0917f1 100644 --- a/lib/Checker/GRExprEngine.cpp +++ b/lib/Checker/GRExprEngine.cpp @@ -897,6 +897,11 @@ void GRExprEngine::VisitLValue(Expr* Ex, ExplodedNode* Pred, return; } + case Stmt::ObjCIsaExprClass: + // FIXME: Do something more intelligent with 'x->isa = ...'. + // For now, just ignore the assignment. + return; + case Stmt::ObjCPropertyRefExprClass: case Stmt::ObjCImplicitSetterGetterRefExprClass: // FIXME: Property assignments are lvalues, but not really "locations". diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 898a33efe1..b95d82f763 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -910,3 +910,13 @@ int rdar_7770737_pos(void) struct rdar_7770737_s f = { .p = (intptr_t)&x }; return x; // expected-warning{{Undefined or garbage value returned to caller}} } + +//===----------------------------------------------------------------------===// +// Test handling of the implicit 'isa' field. For now we don't do anything +// interesting. +//===----------------------------------------------------------------------===// + +void pr6302(id x, Class y) { + // This previously crashed the analyzer (reported in PR 6302) + x->isa = y; +}