From: Ted Kremenek Date: Tue, 29 Apr 2008 05:44:10 +0000 (+0000) Subject: Update typestate logic to support GC-mode. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65c9165dad2ecba22ce1b102aea1c0e6db9914fb;p=clang Update typestate logic to support GC-mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50396 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 55753f3168..9ed4f1db29 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -1288,7 +1288,7 @@ CFRefCount::RefBindings CFRefCount::Update(RefBindings B, SymbolID sym, assert (false && "Unhandled CFRef transition."); case DoNothing: - if (V.getKind() == RefVal::Released) { + if (!GCEnabled && V.getKind() == RefVal::Released) { V = RefVal::makeUseAfterRelease(); hasErr = V.getKind(); break; @@ -1310,8 +1310,13 @@ CFRefCount::RefBindings CFRefCount::Update(RefBindings B, SymbolID sym, break; case RefVal::Released: - V = RefVal::makeUseAfterRelease(); - hasErr = V.getKind(); + if (GCEnabled) + V = RefVal::makeOwned(); + else { + V = RefVal::makeUseAfterRelease(); + hasErr = V.getKind(); + } + break; }