From 62059e809596a419e6fc3e751b2f0b57b7cc51e7 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sun, 21 Sep 2008 06:57:40 +0000 Subject: [PATCH] Add a bug category for NSError** checks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56394 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Analysis/PathSensitive/BugReporter.h | 5 +++++ lib/Analysis/CheckNSError.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/include/clang/Analysis/PathSensitive/BugReporter.h b/include/clang/Analysis/PathSensitive/BugReporter.h index 7f2511f435..bf9aa00fdb 100644 --- a/include/clang/Analysis/PathSensitive/BugReporter.h +++ b/include/clang/Analysis/PathSensitive/BugReporter.h @@ -215,6 +215,11 @@ public: 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); diff --git a/lib/Analysis/CheckNSError.cpp b/lib/Analysis/CheckNSError.cpp index 25f610e833..d4697aa7cd 100644 --- a/lib/Analysis/CheckNSError.cpp +++ b/lib/Analysis/CheckNSError.cpp @@ -47,6 +47,7 @@ public: void EmitWarnings(BugReporter& BR) { EmitGRWarnings(cast(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 @@ void NSErrorCheck::EmitGRWarnings(GRBugReporter& BR) { 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()); -- 2.50.1