[clang] ddb0101 - Revert "[analyzer] RetainCountChecker: Add a suppression for OSSymbols."

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 23:49:53 PST 2021


Author: Artem Dergachev
Date: 2021-02-09T23:44:33-08:00
New Revision: ddb01010b275c68deb7340ec32e0d1beaa9bbf13

URL: https://github.com/llvm/llvm-project/commit/ddb01010b275c68deb7340ec32e0d1beaa9bbf13
DIFF: https://github.com/llvm/llvm-project/commit/ddb01010b275c68deb7340ec32e0d1beaa9bbf13.diff

LOG: Revert "[analyzer] RetainCountChecker: Add a suppression for OSSymbols."

This reverts commit 3500cc8d891bb3825bb3275affe6db8b12f2f695.

This old commit was made over a completely false premise. OSSymbols
aren't different from other OSObjects and we shouldn't treat them
differently for the purposes of static analysis.

Added: 
    

Modified: 
    clang/lib/Analysis/RetainSummaryManager.cpp
    clang/test/Analysis/osobject-retain-release.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/RetainSummaryManager.cpp b/clang/lib/Analysis/RetainSummaryManager.cpp
index 9f45a8efe546..00bc854a8804 100644
--- a/clang/lib/Analysis/RetainSummaryManager.cpp
+++ b/clang/lib/Analysis/RetainSummaryManager.cpp
@@ -146,9 +146,7 @@ static bool isSubclass(const Decl *D,
 }
 
 static bool isOSObjectSubclass(const Decl *D) {
-  // OSSymbols are particular OSObjects that are allocated globally
-  // and therefore aren't really refcounted, so we ignore them.
-  return D && isSubclass(D, "OSMetaClassBase") && !isSubclass(D, "OSSymbol");
+  return D && isSubclass(D, "OSMetaClassBase");
 }
 
 static bool isOSObjectDynamicCast(StringRef S) {

diff  --git a/clang/test/Analysis/osobject-retain-release.cpp b/clang/test/Analysis/osobject-retain-release.cpp
index d88349dcd807..41606a30c39f 100644
--- a/clang/test/Analysis/osobject-retain-release.cpp
+++ b/clang/test/Analysis/osobject-retain-release.cpp
@@ -53,9 +53,6 @@ struct MyArray : public OSArray {
   OSObject *generateObject(OSObject *input) override;
 };
 
-// These are never refcounted.
-struct OSSymbol : OSObject {};
-
 struct OtherStruct {
   static void doNothingToArray(OSArray *array);
   OtherStruct(OSArray *arr);
@@ -757,10 +754,3 @@ void test() {
   b(0);
 }
 } // namespace inherited_constructor_crash
-
-namespace ossymbol_suppression {
-OSSymbol *createSymbol();
-void test() {
-  OSSymbol *sym = createSymbol(); // no-warning
-}
-} // namespace ossymbol_suppression


        


More information about the cfe-commits mailing list