diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-11-25 22:17:44 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-11-25 22:17:44 +0000 |
commit | 70a87883682bbaf3539f3c296c0810a17d8b0898 (patch) | |
tree | 537a63641573801d2092b1498eaf1170cd3c6210 /clang/lib/Analysis/CFRefCount.cpp | |
parent | 945422794ba5a88b19e1f14cea3765610a445142 (diff) | |
download | bcm5719-llvm-70a87883682bbaf3539f3c296c0810a17d8b0898.tar.gz bcm5719-llvm-70a87883682bbaf3539f3c296c0810a17d8b0898.zip |
Add a new RetainReleaseChecker class (that subclasses CheckerVisitor) to extend the functionality of the retain/release checker using the new Checker interface. Pieces of CFRefCount will gradually be migrated to this new class over time.
llvm-svn: 89889
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | clang/lib/Analysis/CFRefCount.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp index deff7ccdc96..10d07762dbf 100644 --- a/clang/lib/Analysis/CFRefCount.cpp +++ b/clang/lib/Analysis/CFRefCount.cpp @@ -22,6 +22,7 @@ #include "clang/Analysis/PathSensitive/BugReporter.h" #include "clang/Analysis/PathSensitive/SymbolManager.h" #include "clang/Analysis/PathSensitive/GRTransferFuncs.h" +#include "clang/Analysis/PathSensitive/CheckerVisitor.h" #include "clang/AST/DeclObjC.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/FoldingSet.h" @@ -3634,6 +3635,22 @@ void CFRefCount::ProcessNonLeakError(ExplodedNodeSet& Dst, } //===----------------------------------------------------------------------===// +// Pieces of the retain/release checker implemented using a CheckerVisitor. +// More pieces of the retain/release checker will be migrated to this interface +// (ideally, all of it some day). +//===----------------------------------------------------------------------===// + +namespace { +class VISIBILITY_HIDDEN RetainReleaseChecker + : public CheckerVisitor<RetainReleaseChecker> { + CFRefCount *TF; +public: + RetainReleaseChecker(CFRefCount *tf) : TF(tf) {} + static void* getTag() { static int x = 0; return &x; } +}; +} // end anonymous namespace + +//===----------------------------------------------------------------------===// // Transfer function creation for external clients. //===----------------------------------------------------------------------===// @@ -3694,6 +3711,11 @@ void CFRefCount::RegisterChecks(GRExprEngine& Eng) { // Save the reference to the BugReporter. this->BR = &BR; + + // Register the RetainReleaseChecker with the GRExprEngine object. + // Functionality in CFRefCount will be migrated to RetainReleaseChecker + // over time. + Eng.registerCheck(new RetainReleaseChecker(this)); } GRTransferFuncs* clang::MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled, |