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;
}
}
bool FullUninitTaint=false);
GRTransferFuncs* MakeGRSimpleValsTF();
-GRTransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
+GRTransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
+ bool StandardWarnings,
const LangOptions& lopts);
BugType* MakeDeadStoresChecker();
// Instance variables.
CFRefSummaryManager Summaries;
- const bool GCEnabled;
+ const bool GCEnabled;
+ const bool EmitStandardWarnings;
const LangOptions& LOpts;
RefBFactoryTy RefBFactory;
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)),
} // 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));
//===----------------------------------------------------------------------===//
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);
}