summaryrefslogtreecommitdiffstats
path: root/compiler-rt/include
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2013-11-18 14:02:05 +0000
committerKostya Serebryany <kcc@google.com>2013-11-18 14:02:05 +0000
commit3d97c2040d1a52a1cd00d61ee58299123cc3c3c0 (patch)
tree588ec15421caf60d5dd1cf416d8b5f3a8f513fc4 /compiler-rt/include
parent4d3457e6287d9921f3cc636c2ecc1b8fac6fa382 (diff)
downloadbcm5719-llvm-3d97c2040d1a52a1cd00d61ee58299123cc3c3c0.tar.gz
bcm5719-llvm-3d97c2040d1a52a1cd00d61ee58299123cc3c3c0.zip
[asan] introduce __sanitizer_annotate_contiguous_container
llvm-svn: 195011
Diffstat (limited to 'compiler-rt/include')
-rw-r--r--compiler-rt/include/sanitizer/common_interface_defs.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler-rt/include/sanitizer/common_interface_defs.h b/compiler-rt/include/sanitizer/common_interface_defs.h
index 70a5c0cd3b0..4cc2aeae23c 100644
--- a/compiler-rt/include/sanitizer/common_interface_defs.h
+++ b/compiler-rt/include/sanitizer/common_interface_defs.h
@@ -50,6 +50,30 @@ extern "C" {
// Record and dump coverage info.
void __sanitizer_cov_dump();
+ // Annotate the current state of a contiguous container, such as
+ // std::vector, std::string or similar.
+ // A contiguous container is a container that keeps all of its elements
+ // in a contiguous region of memory. The container owns the region of memory
+ // [beg, end); the memory [beg, mid) is used to store the current elements
+ // and the memory [mid, end) is reserved for future elements;
+ // end <= mid <= end. For example, in "std::vector<> v"
+ // beg = &v[0];
+ // end = beg + v.capacity() * sizeof(v[0]);
+ // mid = beg + v.size() * sizeof(v[0]);
+ //
+ // This annotation tells the Sanitizer tool about the current state of the
+ // container so that the tool can report errors when memory from [mid, end)
+ // is accessed. Insert this annotation into methods like push_back/pop_back.
+ // Supply the old and the new values of mid (old_mid/new_mid).
+ // In the initial state mid == end and so should be the final
+ // state when the container is destroyed or when it reallocates the storage.
+ //
+ // Use with caution and don't use for anything other than vector-like classes.
+ //
+ // For AddressSanitizer, 'beg' should be 8-aligned.
+ void __sanitizer_annotate_contiguous_container(void *beg, void *end,
+ void *old_mid, void *new_mid);
+
#ifdef __cplusplus
} // extern "C"
#endif
OpenPOWER on IntegriCloud