Add "category" to BugTypes, allowing bugs to be grouped.
Changed casing of many bug names.  The convention will be to have bug names (mostly) lower cased, and categories use some capitalization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56385 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index b163eea..6a1478a 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -701,7 +701,8 @@
   if (R.getBugType().isCached(R))
     return;
 
-  llvm::OwningPtr<PathDiagnostic> D(new PathDiagnostic(R.getName()));
+  llvm::OwningPtr<PathDiagnostic> D(new PathDiagnostic(R.getName(),
+                                                       R.getCategory()));
   GeneratePathDiagnostic(*D.get(), R);
   
   // Get the meta data.
@@ -764,12 +765,17 @@
   }
 }
 
-void
-BugReporter::EmitBasicReport(const char* name, const char* str,
-                             SourceLocation Loc,
-                             SourceRange* RBeg, unsigned NumRanges) {
+void BugReporter::EmitBasicReport(const char* name, const char* str,
+                                  SourceLocation Loc,
+                                  SourceRange* RBeg, unsigned NumRanges) {
+  EmitBasicReport(name, "", str, Loc, RBeg, NumRanges);
+}
   
-  SimpleBugType BT(name);
+void BugReporter::EmitBasicReport(const char* name, const char* category,
+                                  const char* str, SourceLocation Loc,
+                                  SourceRange* RBeg, unsigned NumRanges) {
+  
+  SimpleBugType BT(name, category, 0);
   DiagCollector C(BT);
   Diagnostic& Diag = getDiagnostic();
   Diag.Report(&C, getContext().getFullLoc(Loc),
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 25841cd..dcea4a6 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -2020,6 +2020,10 @@
     const CFRefCount& getTF() const { return TF; }
 
     virtual bool isLeak() const { return false; }
+
+    const char* getCategory() const { 
+      return "Memory (Core Foundation/Objective-C)";
+    }
   };
   
   class VISIBILITY_HIDDEN UseAfterRelease : public CFRefBug {
@@ -2027,7 +2031,7 @@
     UseAfterRelease(CFRefCount& tf) : CFRefBug(tf) {}
     
     virtual const char* getName() const {
-      return "Use-After-Release";
+      return "use-after-release";
     }
     virtual const char* getDescription() const {
       return "Reference-counted object is used after it is released.";
@@ -2041,7 +2045,7 @@
     BadRelease(CFRefCount& tf) : CFRefBug(tf) {}
     
     virtual const char* getName() const {
-      return "Bad Release";
+      return "bad release";
     }
     virtual const char* getDescription() const {
       return "Incorrect decrement of the reference count of a "
@@ -2059,13 +2063,13 @@
     virtual const char* getName() const {
       
       if (getTF().isGCEnabled())
-        return "Memory Leak (GC)";
+        return "Leak (GC)";
       
       if (getTF().getLangOptions().getGCMode() == LangOptions::HybridGC)
-        return "Memory Leak (Hybrid MM, non-GC)";
+        return "leak (hybrid MM, non-GC)";
       
       assert (getTF().getLangOptions().getGCMode() == LangOptions::NonGC);
-      return "Memory Leak";
+      return "leak";
     }
     
     virtual const char* getDescription() const {
diff --git a/lib/Analysis/CheckDeadStores.cpp b/lib/Analysis/CheckDeadStores.cpp
index 73cb3f7..d87bfb1 100644
--- a/lib/Analysis/CheckDeadStores.cpp
+++ b/lib/Analysis/CheckDeadStores.cpp
@@ -59,19 +59,19 @@
       case DeadIncrement:
         BugType = "dead increment";
       case Standard:
-        if (!BugType) BugType = "dead store";
+        if (!BugType) BugType = "dead assignment";
         msg = "Value stored to '" + name + "' is never read";
         break;
         
       case Enclosing:
-        BugType = "dead store";
+        BugType = "dead nested assignment";
         msg = "Although the value stored to '" + name +
           "' is used in the enclosing expression, the value is never actually"
           " read from '" + name + "'";
         break;
     }
       
-    BR.EmitBasicReport(BugType, msg.c_str(), L, R);      
+    BR.EmitBasicReport(BugType, "Dead Store", msg.c_str(), L, R);      
   }
   
   void CheckVarDecl(VarDecl* VD, Expr* Ex, Expr* Val,
diff --git a/lib/Analysis/GRExprEngineInternalChecks.cpp b/lib/Analysis/GRExprEngineInternalChecks.cpp
index 0c5f078..92c448c 100644
--- a/lib/Analysis/GRExprEngineInternalChecks.cpp
+++ b/lib/Analysis/GRExprEngineInternalChecks.cpp
@@ -293,7 +293,7 @@
   
 public:
   CheckAttrNonNull() :
-  BT("'nonnull' argument passed null",
+  BT("'nonnull' argument passed null", "API",
      "Null pointer passed as an argument to a 'nonnull' parameter") {}
 
   virtual bool Audit(ExplodedNode<GRState>* N, GRStateManager& VMgr) {