clang API Documentation
00001 //===--- BugType.h - Bug Information Desciption ----------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines BugType, a class representing a bug type. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_CLANG_ANALYSIS_BUGTYPE 00015 #define LLVM_CLANG_ANALYSIS_BUGTYPE 00016 00017 #include "llvm/ADT/FoldingSet.h" 00018 #include <string> 00019 00020 namespace clang { 00021 00022 namespace ento { 00023 00024 class BugReporter; 00025 class ExplodedNode; 00026 class ExprEngine; 00027 00028 class BugType { 00029 private: 00030 const std::string Name; 00031 const std::string Category; 00032 bool SuppressonSink; 00033 public: 00034 BugType(StringRef name, StringRef cat) 00035 : Name(name), Category(cat), SuppressonSink(false) {} 00036 virtual ~BugType(); 00037 00038 // FIXME: Should these be made strings as well? 00039 StringRef getName() const { return Name; } 00040 StringRef getCategory() const { return Category; } 00041 00042 /// isSuppressOnSink - Returns true if bug reports associated with this bug 00043 /// type should be suppressed if the end node of the report is post-dominated 00044 /// by a sink node. 00045 bool isSuppressOnSink() const { return SuppressonSink; } 00046 void setSuppressOnSink(bool x) { SuppressonSink = x; } 00047 00048 virtual void FlushReports(BugReporter& BR); 00049 }; 00050 00051 class BuiltinBug : public BugType { 00052 virtual void anchor(); 00053 const std::string desc; 00054 public: 00055 BuiltinBug(const char *name, const char *description) 00056 : BugType(name, "Logic error"), desc(description) {} 00057 00058 BuiltinBug(const char *name) 00059 : BugType(name, "Logic error"), desc(name) {} 00060 00061 StringRef getDescription() const { return desc; } 00062 }; 00063 00064 } // end GR namespace 00065 00066 } // end clang namespace 00067 #endif