[cfe-commits] please review: adding module-level metadata for ThreadSanitizer

Kostya Serebryany kcc at google.com
Wed Aug 22 00:20:03 PDT 2012


Hello,

I'd like to resurrect an old discussion: how to selectively disable
ThreadSanitizer (or AddressSanitizer, etc) instrumentation
for particular functions.
For AddressSanitizer we currently use a function attribute "AddressSafety"
(if it is not set, instrumentation does not happen),
but Chris doesn't like this idea (attributes are a scarce resource) and he
suggested to use module-level metadata instead of an attribute.

The attached clang patch adds such metadata node for all functions when
-fthread-sanitizer is given.
If that is what we want, I'll gradually change AddressSanitizer to use
similar approach and will kill the "AddressSafety" attribute.

BTW, the code looks like this:
  llvm::Value *Fn[] = { F }; ...
  llvm::MDNode::get(VMContext, Fn);
Do we want this code to look like
  llvm::MDNode::get(VMContext, F);
(i.e. to add more llvm::MDNode::get() methods)?

Thanks,

--kcc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120822/4a3e8d33/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tsan_metadata.patch
Type: application/octet-stream
Size: 867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120822/4a3e8d33/attachment.obj>


More information about the cfe-commits mailing list