[cfe-commits] r50584 - in /cfe/trunk: Driver/ASTConsumers.cpp include/clang/Analysis/LocalCheckers.h lib/Analysis/CFRefCount.cpp
Ted Kremenek
kremenek at apple.com
Fri May 2 11:01:49 PDT 2008
Author: kremenek
Date: Fri May 2 13:01:49 2008
New Revision: 50584
URL: http://llvm.org/viewvc/llvm-project?rev=50584&view=rev
Log:
When running the reference count checker twice (GC and non-GC mode), only emit
basic warnings (dead stores, null dereferences) on the first pass.
Modified:
cfe/trunk/Driver/ASTConsumers.cpp
cfe/trunk/include/clang/Analysis/LocalCheckers.h
cfe/trunk/lib/Analysis/CFRefCount.cpp
Modified: cfe/trunk/Driver/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.cpp?rev=50584&r1=50583&r2=50584&view=diff
==============================================================================
--- cfe/trunk/Driver/ASTConsumers.cpp (original)
+++ cfe/trunk/Driver/ASTConsumers.cpp Fri May 2 13:01:49 2008
@@ -813,16 +813,16 @@
virtual void getTransferFunctions(std::vector<GRTransferFuncs*>& TFs) {
switch (LangOpts.getGCMode()) {
case LangOptions::NonGC:
- TFs.push_back(MakeCFRefCountTF(*Ctx, false, LangOpts));
+ TFs.push_back(MakeCFRefCountTF(*Ctx, false, true, LangOpts));
break;
case LangOptions::GCOnly:
- TFs.push_back(MakeCFRefCountTF(*Ctx, true, LangOpts));
+ TFs.push_back(MakeCFRefCountTF(*Ctx, true, true, LangOpts));
break;
case LangOptions::HybridGC:
- TFs.push_back(MakeCFRefCountTF(*Ctx, false, LangOpts));
- TFs.push_back(MakeCFRefCountTF(*Ctx, true, LangOpts));
+ TFs.push_back(MakeCFRefCountTF(*Ctx, false, true, LangOpts));
+ TFs.push_back(MakeCFRefCountTF(*Ctx, true, false, LangOpts));
break;
}
}
Modified: cfe/trunk/include/clang/Analysis/LocalCheckers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/LocalCheckers.h?rev=50584&r1=50583&r2=50584&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/LocalCheckers.h (original)
+++ cfe/trunk/include/clang/Analysis/LocalCheckers.h Fri May 2 13:01:49 2008
@@ -32,7 +32,8 @@
bool FullUninitTaint=false);
GRTransferFuncs* MakeGRSimpleValsTF();
-GRTransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
+GRTransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
+ bool StandardWarnings,
const LangOptions& lopts);
BugType* MakeDeadStoresChecker();
Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=50584&r1=50583&r2=50584&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Fri May 2 13:01:49 2008
@@ -626,7 +626,8 @@
// Instance variables.
CFRefSummaryManager Summaries;
- const bool GCEnabled;
+ const bool GCEnabled;
+ const bool EmitStandardWarnings;
const LangOptions& LOpts;
RefBFactoryTy RefBFactory;
@@ -674,9 +675,11 @@
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 @@
} // 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 @@
//===----------------------------------------------------------------------===//
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);
}
More information about the cfe-commits
mailing list