aboutsummaryrefslogtreecommitdiff
path: root/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/BugReporter/BugType.h')
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugType.h32
1 files changed, 21 insertions, 11 deletions
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
index 49f9c83ba950..24c778552ee4 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
@@ -14,8 +14,9 @@
#ifndef LLVM_CLANG_ANALYSIS_BUGTYPE
#define LLVM_CLANG_ANALYSIS_BUGTYPE
-#include "clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h"
#include "clang/Basic/LLVM.h"
+#include "clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h"
+#include "clang/StaticAnalyzer/Core/Checker.h"
#include "llvm/ADT/FoldingSet.h"
#include <string>
@@ -29,20 +30,25 @@ class ExprEngine;
class BugType {
private:
+ const CheckName Check;
const std::string Name;
const std::string Category;
bool SuppressonSink;
virtual void anchor();
public:
- BugType(StringRef name, StringRef cat)
- : Name(name), Category(cat), SuppressonSink(false) {}
+ BugType(class CheckName check, StringRef name, StringRef cat)
+ : Check(check), Name(name), Category(cat), SuppressonSink(false) {}
+ BugType(const CheckerBase *checker, StringRef name, StringRef cat)
+ : Check(checker->getCheckName()), Name(name), Category(cat),
+ SuppressonSink(false) {}
virtual ~BugType() {}
// FIXME: Should these be made strings as well?
StringRef getName() const { return Name; }
StringRef getCategory() const { return Category; }
-
+ StringRef getCheckName() const { return Check.getName(); }
+
/// isSuppressOnSink - Returns true if bug reports associated with this bug
/// type should be suppressed if the end node of the report is post-dominated
/// by a sink node.
@@ -54,14 +60,18 @@ public:
class BuiltinBug : public BugType {
const std::string desc;
- virtual void anchor();
+ void anchor() override;
public:
- BuiltinBug(const char *name, const char *description)
- : BugType(name, categories::LogicError), desc(description) {}
-
- BuiltinBug(const char *name)
- : BugType(name, categories::LogicError), desc(name) {}
-
+ BuiltinBug(class CheckName check, const char *name, const char *description)
+ : BugType(check, name, categories::LogicError), desc(description) {}
+
+ BuiltinBug(const CheckerBase *checker, const char *name,
+ const char *description)
+ : BugType(checker, name, categories::LogicError), desc(description) {}
+
+ BuiltinBug(const CheckerBase *checker, const char *name)
+ : BugType(checker, name, categories::LogicError), desc(name) {}
+
StringRef getDescription() const { return desc; }
};