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 55753f3..9ed4f1d 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1288,7 +1288,7 @@
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 @@
break;
case RefVal::Released:
- V = RefVal::makeUseAfterRelease();
- hasErr = V.getKind();
+ if (GCEnabled)
+ V = RefVal::makeOwned();
+ else {
+ V = RefVal::makeUseAfterRelease();
+ hasErr = V.getKind();
+ }
+
break;
}