[PATCH] [tsan] Move some suppressions-related code to common. Factor out code to be reused in LSan. Also switch from linked list to vector.

Dmitry Vyukov dvyukov at google.com
Tue Jun 25 09:59:09 PDT 2013



================
Comment at: lib/sanitizer_common/sanitizer_suppressions.h:25
@@ +24,3 @@
+  unsigned hit_count;
+  uptr weight;
+};
----------------
remove this for now
add when it is actually used

================
Comment at: lib/sanitizer_common/sanitizer_suppressions.h:1
@@ +1,2 @@
+//===-- sanitizer_suppressions.h --------------------------------*- C++ -*-===//
+//
----------------
please use 'svn cp' to copy these files, it should preserve history and minimize diffs

================
Comment at: lib/sanitizer_common/sanitizer_suppressions.h:31
@@ +30,3 @@
+                      InternalMmapVector<Suppression> *suppressions);
+bool TemplateMatch(char *templ, const char *str);
+bool SuppressionMatch(const char *str, int type,
----------------
this is for testing, right?
please add // for testing

================
Comment at: lib/sanitizer_common/sanitizer_suppressions.h:30
@@ +29,3 @@
+                      uptr supp_type_count,
+                      InternalMmapVector<Suppression> *suppressions);
+bool TemplateMatch(char *templ, const char *str);
----------------
this does not look right that users need to spell this name

either make it an opaque pointer:

struct SuppressionContext {
  ...
};

void SuppressionInit(SuppressionContext *ctx, ...);
void SuppressionParse(SuppressionContext *ctx, ...);
void SuppressionMatch(SuppressionContext *ctx, ...);

or make a static global variable in sanitizer_suppressions.cc, so that users do not need to pass it at all (this may require SuppressionReset() function for tests).

Both options will allow to e.g. add an additional variable to suppression state, something that is not possible now.

================
Comment at: lib/sanitizer_common/sanitizer_suppressions.h:34
@@ +33,3 @@
+                      InternalMmapVector<Suppression> *suppressions,
+                      uptr *index);
+
----------------
this should return Suppression*
if we switch back to list representation, index will be a bad "pointer"


http://llvm-reviews.chandlerc.com/D1037



More information about the llvm-commits mailing list