Page MenuHomePhabricator

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

Authored by earthdok on Jun 25 2013, 8:59 AM.

Details

Reviewers
dvyukov

Diff Detail

Event Timeline

+llvm-commits

dvyukov added inline comments.Jun 25 2013, 9:59 AM
lib/sanitizer_common/sanitizer_suppressions.h
2

please use 'svn cp' to copy these files, it should preserve history and minimize diffs

26

remove this for now
add when it is actually used

31

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.

32

this is for testing, right?
please add // for testing

35

this should return Suppression*
if we switch back to list representation, index will be a bad "pointer"

earthdok updated this revision to Unknown Object (????).Jun 26 2013, 7:12 AM
  • Introduced SuppressionContext and moved suppression types into common.
earthdok updated this revision to Unknown Object (????).Jun 26 2013, 7:18 AM
  • mostly lint
earthdok updated this revision to Unknown Object (????).Jun 26 2013, 7:27 AM
  • more cleanup
dvyukov added inline comments.Jun 26 2013, 7:37 AM
lib/sanitizer_common/sanitizer_suppressions.h
22

why it is here now?
it's tool-specific.

37

this is unnecessary, remove

43

set initialized_=true in Match()?

46

I would add PrintMatched() method, then this is unnecesasry

earthdok added inline comments.Jun 26 2013, 7:47 AM
lib/sanitizer_common/sanitizer_suppressions.h
22

I think this is better and cleaner than having to pass strings around. It's awkward to not have the string-enum correspondence encapsulated in this module. I also don't see any good reasons why tools can't share this enum. (We're already sharing the Suppression struct, after all - and that is also tool-specific to some extent.) At some point we might even want to read suppressions for several tools out of one file.

37

ok

43

I think explicit is better than implicit, but ok.

46

PrintMatched() *is* tool-specific.

dvyukov added inline comments.Jun 26 2013, 7:51 AM
lib/sanitizer_common/sanitizer_suppressions.h
46

How will it be different for lsan?

earthdok updated this revision to Unknown Object (????).Jun 26 2013, 7:56 AM
  • addressed dvyukov's comments
earthdok added inline comments.Jun 26 2013, 7:57 AM
lib/sanitizer_common/sanitizer_suppressions.h
46

It will print the # of bytes leaked, at least.

dvyukov added inline comments.Jun 26 2013, 8:05 AM
lib/sanitizer_common/sanitizer_suppressions.h
46

just don't print it if it's zero

earthdok added inline comments.Jun 26 2013, 8:21 AM
lib/sanitizer_common/sanitizer_suppressions.h
46

The output format will probably be different too. I would really prefer to not have to care about TSan compatibility while I'm figuring it out.

dvyukov added inline comments.Jun 26 2013, 8:27 AM
lib/sanitizer_common/sanitizer_suppressions.h
46

there is value for end users in a single format, e.g. chromium has scripts that parse matched suppressions

dvyukov accepted this revision.Jun 26 2013, 8:37 AM

rubber stamp

earthdok closed this revision.Dec 5 2014, 9:43 AM