This revision was automatically updated to reflect the committed changes. Closed by commit rG6f5431846bbf: [analyzer][RetainCount] Remove the CheckOSObject option (authored by Szelethus).
Changed prior to commit: https://reviews.llvm.org/D78097?vs=257272&id=266166#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78097/new/ https://reviews.llvm.org/D78097 Files: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp clang/test/Analysis/analyzer-config.c clang/test/Analysis/test-separate-retaincount.cpp Index: clang/test/Analysis/test-separate-retaincount.cpp =================================================================== --- clang/test/Analysis/test-separate-retaincount.cpp +++ clang/test/Analysis/test-separate-retaincount.cpp @@ -5,10 +5,6 @@ // RUN: %clang_analyze_cc1 -std=c++14 -DNO_OS_OBJECT -verify %s \ // RUN: -analyzer-checker=core,osx \ // RUN: -analyzer-disable-checker osx.OSObjectRetainCount -// -// RUN: %clang_analyze_cc1 -std=c++14 -DNO_OS_OBJECT -verify %s \ -// RUN: -analyzer-checker=core,osx \ -// RUN: -analyzer-config "osx.cocoa.RetainCount:CheckOSObject=false" #include "os_object_base.h" Index: clang/test/Analysis/analyzer-config.c =================================================================== --- clang/test/Analysis/analyzer-config.c +++ clang/test/Analysis/analyzer-config.c @@ -99,7 +99,6 @@ // CHECK-NEXT: optin.osx.cocoa.localizability.NonLocalizedStringChecker:AggressiveReport = false // CHECK-NEXT: optin.performance.Padding:AllowedPad = 24 // CHECK-NEXT: osx.NumberObjectConversion:Pedantic = false -// CHECK-NEXT: osx.cocoa.RetainCount:CheckOSObject = true // CHECK-NEXT: osx.cocoa.RetainCount:TrackNSCFStartParam = false // CHECK-NEXT: prune-paths = true // CHECK-NEXT: region-store-small-struct-limit = 2 Index: clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp =================================================================== --- clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp +++ clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp @@ -1481,26 +1481,11 @@ return true; } -// FIXME: remove this, hack for backwards compatibility: -// it should be possible to enable the NS/CF retain count checker as -// osx.cocoa.RetainCount, and it should be possible to disable -// osx.OSObjectRetainCount using osx.cocoa.RetainCount:CheckOSObject=false. -static bool getOption(const AnalyzerOptions &Options, - StringRef Postfix, - StringRef Value) { - auto I = Options.Config.find( - (StringRef("osx.cocoa.RetainCount:") + Postfix).str()); - if (I != Options.Config.end()) - return I->getValue() == Value; - return false; -} - void ento::registerRetainCountChecker(CheckerManager &Mgr) { auto *Chk = Mgr.getChecker<RetainCountChecker>(); Chk->TrackObjCAndCFObjects = true; - Chk->TrackNSCFStartParam = getOption(Mgr.getAnalyzerOptions(), - "TrackNSCFStartParam", - "true"); + Chk->TrackNSCFStartParam = Mgr.getAnalyzerOptions().getCheckerBooleanOption( + Mgr.getCurrentCheckerName(), "TrackNSCFStartParam"); } bool ento::shouldRegisterRetainCountChecker(const CheckerManager &mgr) { @@ -1509,10 +1494,7 @@ void ento::registerOSObjectRetainCountChecker(CheckerManager &Mgr) { auto *Chk = Mgr.getChecker<RetainCountChecker>(); - if (!getOption(Mgr.getAnalyzerOptions(), - "CheckOSObject", - "false")) - Chk->TrackOSObjects = true; + Chk->TrackOSObjects = true; } bool ento::shouldRegisterOSObjectRetainCountChecker(const CheckerManager &mgr) { Index: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td =================================================================== --- clang/include/clang/StaticAnalyzer/Checkers/Checkers.td +++ clang/include/clang/StaticAnalyzer/Checkers/Checkers.td @@ -1095,15 +1095,6 @@ HelpText<"Check for leaks and improper reference count management">, CheckerOptions<[ CmdLineOption<Boolean, - "CheckOSObject", - "Find violations of retain-release rules applied to XNU " - "OSObject instances. By default, the checker only checks " - "retain-release rules for Objective-C NSObject instances " - "and CoreFoundation objects.", - "true", - InAlpha, - Hide>, - CmdLineOption<Boolean, "TrackNSCFStartParam", "Check not only that the code follows retain-release rules " "with respect to objects it allocates or borrows from "
Index: clang/test/Analysis/test-separate-retaincount.cpp =================================================================== --- clang/test/Analysis/test-separate-retaincount.cpp +++ clang/test/Analysis/test-separate-retaincount.cpp @@ -5,10 +5,6 @@ // RUN: %clang_analyze_cc1 -std=c++14 -DNO_OS_OBJECT -verify %s \ // RUN: -analyzer-checker=core,osx \ // RUN: -analyzer-disable-checker osx.OSObjectRetainCount -// -// RUN: %clang_analyze_cc1 -std=c++14 -DNO_OS_OBJECT -verify %s \ -// RUN: -analyzer-checker=core,osx \ -// RUN: -analyzer-config "osx.cocoa.RetainCount:CheckOSObject=false" #include "os_object_base.h" Index: clang/test/Analysis/analyzer-config.c =================================================================== --- clang/test/Analysis/analyzer-config.c +++ clang/test/Analysis/analyzer-config.c @@ -99,7 +99,6 @@ // CHECK-NEXT: optin.osx.cocoa.localizability.NonLocalizedStringChecker:AggressiveReport = false // CHECK-NEXT: optin.performance.Padding:AllowedPad = 24 // CHECK-NEXT: osx.NumberObjectConversion:Pedantic = false -// CHECK-NEXT: osx.cocoa.RetainCount:CheckOSObject = true // CHECK-NEXT: osx.cocoa.RetainCount:TrackNSCFStartParam = false // CHECK-NEXT: prune-paths = true // CHECK-NEXT: region-store-small-struct-limit = 2 Index: clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp =================================================================== --- clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp +++ clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp @@ -1481,26 +1481,11 @@ return true; } -// FIXME: remove this, hack for backwards compatibility: -// it should be possible to enable the NS/CF retain count checker as -// osx.cocoa.RetainCount, and it should be possible to disable -// osx.OSObjectRetainCount using osx.cocoa.RetainCount:CheckOSObject=false. -static bool getOption(const AnalyzerOptions &Options, - StringRef Postfix, - StringRef Value) { - auto I = Options.Config.find( - (StringRef("osx.cocoa.RetainCount:") + Postfix).str()); - if (I != Options.Config.end()) - return I->getValue() == Value; - return false; -} - void ento::registerRetainCountChecker(CheckerManager &Mgr) { auto *Chk = Mgr.getChecker<RetainCountChecker>(); Chk->TrackObjCAndCFObjects = true; - Chk->TrackNSCFStartParam = getOption(Mgr.getAnalyzerOptions(), - "TrackNSCFStartParam", - "true"); + Chk->TrackNSCFStartParam = Mgr.getAnalyzerOptions().getCheckerBooleanOption( + Mgr.getCurrentCheckerName(), "TrackNSCFStartParam"); } bool ento::shouldRegisterRetainCountChecker(const CheckerManager &mgr) { @@ -1509,10 +1494,7 @@ void ento::registerOSObjectRetainCountChecker(CheckerManager &Mgr) { auto *Chk = Mgr.getChecker<RetainCountChecker>(); - if (!getOption(Mgr.getAnalyzerOptions(), - "CheckOSObject", - "false")) - Chk->TrackOSObjects = true; + Chk->TrackOSObjects = true; } bool ento::shouldRegisterOSObjectRetainCountChecker(const CheckerManager &mgr) { Index: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td =================================================================== --- clang/include/clang/StaticAnalyzer/Checkers/Checkers.td +++ clang/include/clang/StaticAnalyzer/Checkers/Checkers.td @@ -1095,15 +1095,6 @@ HelpText<"Check for leaks and improper reference count management">, CheckerOptions<[ CmdLineOption<Boolean, - "CheckOSObject", - "Find violations of retain-release rules applied to XNU " - "OSObject instances. By default, the checker only checks " - "retain-release rules for Objective-C NSObject instances " - "and CoreFoundation objects.", - "true", - InAlpha, - Hide>, - CmdLineOption<Boolean, "TrackNSCFStartParam", "Check not only that the code follows retain-release rules " "with respect to objects it allocates or borrows from "
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits