[libcxx-commits] [PATCH] D145628: [ASan][libcxx] A way to turn off annotations for containers with a specific allocator

Tacet via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 20 11:01:28 PDT 2023


AdvenamTacet added inline comments.


================
Comment at: libcxx/docs/UsingLibcxx.rst:527
+If ``__asan_annotate_container_with_allocator<_Alloc>::value == false``, container won't be poisoned at all.
+Value may be changed by template specialization. Variable ``value`` is of type ``bool``.
+
----------------
hans wrote:
> AdvenamTacet wrote:
> > hans wrote:
> > > Could you please include a code example which shows how to do the specialization?
> > > 
> > > Also, will it be possible to write this in a way that works both with libc++ versions that have and don't have this change?
> > I added examples. I hope those are helpful. If you believe that another example is necessary as well, let me know.
> > 
> > > Also, will it be possible to write this in a way that works both with libc++ versions that have and don't have this change?
> > 
> > Possibly a macro would be answer to that, I suggested one in an update comment. But it should be possible to solve easily with libc++ version number as well. I don't really like the idea of creating a macro here.
> This is great, thanks!
> 
> I'd suggest writing the example in a way that's portable, i.e. that will work both with libc++ versions which do and do not have this feature, as well as other standard libraries.
> 
> In order to do that, I guess we'll need some kind of feature test macro. I don't think checking the libc++ version number is a good solution as it's not fine grained enough. I'm guessing libc++ has some kind of mechanism for this already similar to the standard feature test macros.
I don't really see a good way to do it and believe that relaying on libc++ version seems the best option. If @philnik or @ldionne think that some macro should be created, I will do it. Just I have to know what macro exactly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145628/new/

https://reviews.llvm.org/D145628



More information about the libcxx-commits mailing list