[PATCH] D17528: [analyzer] Warn on use of 'self' after call to to [super dealloc].

Anna Zaks via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 24 22:40:55 PST 2016


zaks.anna added inline comments.

================
Comment at: lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp:165
@@ +164,3 @@
+  if (Desc.empty())
+    Desc = "use of 'self' after it is freed with call to [super dealloc]";
+
----------------
Does "has been freed" sound better?

================
Comment at: test/Analysis/DeallocUseAfterFreeErrors.m:59
@@ +58,3 @@
+  [super dealloc]; // expected-note {{[super dealloc] called here}}
+  _delegate = nil; // expected-warning {{use of 'self' after it is freed with call to [super dealloc]}}
+      // expected-note at -1 {{use of 'self' after it is freed with call to [super dealloc]}}
----------------
Would it be possible to provide a more presice error message here? Specifically, we refer to 'self' here but the reference is implicit. I guess we could say something like "accessing an instance variable after the object has been freed". Would that require extra checking to ensure that we are indeed accessing a member in checkLocation?


http://reviews.llvm.org/D17528





More information about the cfe-commits mailing list