1 //===--- BugType.h - Bug Information Desciption ----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines BugType, a class representing a bug type.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_ANALYSIS_BUGTYPE
15 #define LLVM_CLANG_ANALYSIS_BUGTYPE
17 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
18 #include "llvm/ADT/FoldingSet.h"
30 const std::string Name;
31 const std::string Category;
34 BugType(llvm::StringRef name, llvm::StringRef cat)
35 : Name(name), Category(cat), SuppressonSink(false) {}
38 // FIXME: Should these be made strings as well?
39 llvm::StringRef getName() const { return Name; }
40 llvm::StringRef getCategory() const { return Category; }
42 /// isSuppressOnSink - Returns true if bug reports associated with this bug
43 /// type should be suppressed if the end node of the report is post-dominated
45 bool isSuppressOnSink() const { return SuppressonSink; }
46 void setSuppressOnSink(bool x) { SuppressonSink = x; }
48 virtual void FlushReports(BugReporter& BR);
51 class BuiltinBug : public BugType {
52 const std::string desc;
54 BuiltinBug(const char *name, const char *description)
55 : BugType(name, "Logic error"), desc(description) {}
57 BuiltinBug(const char *name)
58 : BugType(name, "Logic error"), desc(name) {}
60 llvm::StringRef getDescription() const { return desc; }
65 } // end clang namespace