diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-05-02 18:01:49 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-05-02 18:01:49 +0000 |
commit | 9f7416138b8befe2d274f6f2cadc792d2c279711 (patch) | |
tree | b74f4c93dc3e0ad616a86bd88cc35f7fb86624b3 /lib/Analysis/CFRefCount.cpp | |
parent | c29efd829a638fff380284f43c79355b98e2a2ab (diff) |
When running the reference count checker twice (GC and non-GC mode), only emit
basic warnings (dead stores, null dereferences) on the first pass.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index e62632cad8..c3da51bd12 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -626,7 +626,8 @@ private: // Instance variables. CFRefSummaryManager Summaries; - const bool GCEnabled; + const bool GCEnabled; + const bool EmitStandardWarnings; const LangOptions& LOpts; RefBFactoryTy RefBFactory; @@ -674,9 +675,11 @@ private: public: - CFRefCount(ASTContext& Ctx, bool gcenabled, const LangOptions& lopts) + CFRefCount(ASTContext& Ctx, bool gcenabled, bool StandardWarnings, + const LangOptions& lopts) : Summaries(Ctx, gcenabled), GCEnabled(gcenabled), + EmitStandardWarnings(StandardWarnings), LOpts(lopts), RetainSelector(GetNullarySelector("retain", Ctx)), ReleaseSelector(GetNullarySelector("release", Ctx)), @@ -1539,7 +1542,7 @@ namespace { } // end anonymous namespace void CFRefCount::RegisterChecks(GRExprEngine& Eng) { - GRSimpleVals::RegisterChecks(Eng); + if (EmitStandardWarnings) GRSimpleVals::RegisterChecks(Eng); Eng.Register(new UseAfterRelease(*this)); Eng.Register(new BadRelease(*this)); Eng.Register(new Leak(*this)); @@ -1793,6 +1796,7 @@ void Leak::GetErrorNodes(std::vector<ExplodedNode<ValueState>*>& Nodes) { //===----------------------------------------------------------------------===// GRTransferFuncs* clang::MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled, + bool StandardWarnings, const LangOptions& lopts) { - return new CFRefCount(Ctx, GCEnabled, lopts); + return new CFRefCount(Ctx, GCEnabled, StandardWarnings, lopts); } |