[cfe-commits] r56394 - in /cfe/trunk: include/clang/Analysis/PathSensitive/BugReporter.h lib/Analysis/CheckNSError.cpp

Ted Kremenek kremenek at apple.com
Sat Sep 20 23:57:41 PDT 2008


Author: kremenek
Date: Sun Sep 21 01:57:40 2008
New Revision: 56394

URL: http://llvm.org/viewvc/llvm-project?rev=56394&view=rev
Log:
Add a bug category for NSError** checks.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h
    cfe/trunk/lib/Analysis/CheckNSError.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h?rev=56394&r1=56393&r2=56394&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h Sun Sep 21 01:57:40 2008
@@ -215,6 +215,11 @@
     EmitBasicReport(BugName, BugStr, Loc, 0, 0);
   }
   
+  void EmitBasicReport(const char* BugName, const char* BugCategory,
+                       const char* BugStr, SourceLocation Loc) {
+    EmitBasicReport(BugName, BugCategory, BugStr, Loc, 0, 0);
+  }
+  
   void EmitBasicReport(const char* BugName, const char* BugStr,
                        SourceLocation Loc, SourceRange R) {
     EmitBasicReport(BugName, BugStr, Loc, &R, 1);

Modified: cfe/trunk/lib/Analysis/CheckNSError.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CheckNSError.cpp?rev=56394&r1=56393&r2=56394&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CheckNSError.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckNSError.cpp Sun Sep 21 01:57:40 2008
@@ -47,6 +47,7 @@
   void EmitWarnings(BugReporter& BR) { EmitGRWarnings(cast<GRBugReporter>(BR));}
   const char* getName() const { return "NSError** null dereference"; }
   const char* getDescription() const { return desc; }
+  const char* getCategory() const { return "Coding Conventions (Apple)"; }
 };  
   
 } // end anonymous namespace
@@ -79,6 +80,7 @@
   
   if (ResultTy == Ctx.VoidTy) {
     BR.EmitBasicReport("Bad return type when passing NSError**",
+              getCategory(),
               "Method accepting NSError** argument should have "
               "non-void return value to indicate that an error occurred.",
               CodeDecl.getLocation());





More information about the cfe-commits mailing list