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
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index e62632c..c3da51b 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -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);
 }