Home | History | Annotate | Download | only in tsan
      1 #ifndef TSAN_IGNORE_H__
      2 #define TSAN_IGNORE_H__
      3 
      4 #include "common_util.h"
      5 
      6 // A triple of patterns to ignore a function, an object file and a source file
      7 // by their names.
      8 struct IgnoreTriple {
      9   string fun;
     10   string obj;
     11   string file;
     12 
     13   IgnoreTriple(string ifun, string iobj, string ifile) : fun(ifun) {
     14     obj = ConvertToPlatformIndependentPath(iobj);
     15     file = ConvertToPlatformIndependentPath(ifile);
     16     CHECK(!((ifun == "*") && (iobj == "*") && (ifile == "*")));
     17   }
     18 };
     19 
     20 struct IgnoreObj : public IgnoreTriple {
     21   IgnoreObj(string obj) : IgnoreTriple("*", obj, "*") {}
     22 };
     23 
     24 struct IgnoreFun : public IgnoreTriple {
     25   IgnoreFun(string fun) : IgnoreTriple(fun, "*", "*") {}
     26 };
     27 
     28 struct IgnoreFile : public IgnoreTriple {
     29   IgnoreFile(string file) : IgnoreTriple("*", "*", file) {}
     30 };
     31 
     32 struct IgnoreLists {
     33   vector<IgnoreTriple> ignores;
     34   vector<IgnoreTriple> ignores_r;
     35   vector<IgnoreTriple> ignores_hist;
     36 };
     37 
     38 extern IgnoreLists *g_ignore_lists;
     39 extern vector<string> *g_ignore_obj;
     40 
     41 extern IgnoreLists *g_white_lists;
     42 
     43 void ReadIgnoresFromString(const string& ignoreString,
     44     IgnoreLists* ignoreLists);
     45 
     46 bool TripleVectorMatchKnown(const vector<IgnoreTriple>& v,
     47     const string& fun,
     48     const string& obj,
     49     const string& file);
     50 
     51 bool StringVectorMatch(const vector<string>& v, const string& obj);
     52 
     53 #endif
     54