BugType.h revision 404fc3ad6bd844bf8ce70cbf9974ab297704a122
1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)//===--- BugType.h - Bug Information Desciption ----------------*- C++ -*-===// 258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// 358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// The LLVM Compiler Infrastructure 458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// 5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// This file is distributed under the University of Illinois Open Source 658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// License. See LICENSE.TXT for details. 758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// 858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)//===----------------------------------------------------------------------===// 958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// 1058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// This file defines BugType, a class representing a bug type. 1158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// 1258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)//===----------------------------------------------------------------------===// 1358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 1458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#ifndef LLVM_CLANG_ANALYSIS_BUGTYPE 1558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#define LLVM_CLANG_ANALYSIS_BUGTYPE 1658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 1758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h" 1858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "llvm/ADT/FoldingSet.h" 1958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include <string> 2058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 2158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)namespace clang { 22 23namespace ento { 24 25class ExplodedNode; 26class ExprEngine; 27 28class BugType { 29private: 30 const std::string Name; 31 const std::string Category; 32 bool SuppressonSink; 33public: 34 BugType(llvm::StringRef name, llvm::StringRef cat) 35 : Name(name), Category(cat), SuppressonSink(false) {} 36 virtual ~BugType(); 37 38 // FIXME: Should these be made strings as well? 39 llvm::StringRef getName() const { return Name; } 40 llvm::StringRef getCategory() const { return Category; } 41 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 44 /// by a sink node. 45 bool isSuppressOnSink() const { return SuppressonSink; } 46 void setSuppressOnSink(bool x) { SuppressonSink = x; } 47 48 virtual void FlushReports(BugReporter& BR); 49}; 50 51class BuiltinBug : public BugType { 52 const std::string desc; 53public: 54 BuiltinBug(const char *name, const char *description) 55 : BugType(name, "Logic error"), desc(description) {} 56 57 BuiltinBug(const char *name) 58 : BugType(name, "Logic error"), desc(name) {} 59 60 llvm::StringRef getDescription() const { return desc; } 61}; 62 63} // end GR namespace 64 65} // end clang namespace 66#endif 67