diff --git a/compiler-rt/include/sanitizer/common_interface_defs.h b/compiler-rt/include/sanitizer/common_interface_defs.h --- a/compiler-rt/include/sanitizer/common_interface_defs.h +++ b/compiler-rt/include/sanitizer/common_interface_defs.h @@ -129,26 +129,23 @@ /// state mid == end, so that should be the final state when the /// container is destroyed or when the container reallocates the storage. /// -/// For ASan, beg should be 8-aligned and end -/// should be either 8-aligned or it should point to the end of a separate -/// heap-, stack-, or global-allocated buffer. So the following example will -/// not work: +/// For ASan, beg no longer needs to be 8-aligned, +/// first and last granule may be shared with other objects +/// and therefore the function can be used for any allocator. /// -/// \code -/// int64_t x[2]; // 16 bytes, 8-aligned -/// char *beg = (char *)&x[0]; -/// char *end = beg + 12; // Not 8-aligned, not the end of the buffer -/// \endcode +/// The following example shows how to use the function: /// -/// The following, however, will work: /// \code -/// int32_t x[3]; // 12 bytes, but 8-aligned under ASan. +/// int32_t x[3]; // 12 bytes /// char *beg = (char*)&x[0]; -/// char *end = beg + 12; // Not 8-aligned, but is the end of the buffer +/// char *end = beg + 12; +/// __sanitizer_annotate_contiguous_container(beg, end, beg, end); /// \endcode /// /// \note Use this function with caution and do not use for anything other /// than vector-like classes. +/// \note Unaligned beg or end may miss bugs in +/// these granules. /// /// \param beg Beginning of memory region. /// \param end End of memory region.