diff options
author | Kostya Serebryany <kcc@google.com> | 2013-02-26 06:58:27 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2013-02-26 06:58:27 +0000 |
commit | 4c0fc9931e5af027bee100a26062fe40283727ee (patch) | |
tree | ecf1ed318b3f90b425b5dd7c66ce8a68d61ad862 /clang/docs | |
parent | cf880b94434ddfcba2d5c7b0deb588591b0d8a08 (diff) | |
download | bcm5719-llvm-4c0fc9931e5af027bee100a26062fe40283727ee.tar.gz bcm5719-llvm-4c0fc9931e5af027bee100a26062fe40283727ee.zip |
Unify clang/llvm attributes for asan/tsan/msan (Clang part)
These are two related changes (one in llvm, one in clang).
LLVM:
- rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode)
- rename thread_safety => sanitize_thread
- rename no_uninitialized_checks -> sanitize_memory
CLANG:
- add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis))
- add __attribute__((no_sanitize_thread))
- add __attribute__((no_sanitize_memory))
for S in address thread memory
If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not
set llvm attribute sanitize_S
llvm-svn: 176076
Diffstat (limited to 'clang/docs')
-rw-r--r-- | clang/docs/AddressSanitizer.rst | 5 | ||||
-rw-r--r-- | clang/docs/LanguageExtensions.rst | 30 | ||||
-rw-r--r-- | clang/docs/MemorySanitizer.rst | 13 | ||||
-rw-r--r-- | clang/docs/ThreadSanitizer.rst | 17 |
4 files changed, 61 insertions, 4 deletions
diff --git a/clang/docs/AddressSanitizer.rst b/clang/docs/AddressSanitizer.rst index 357ebd9d93e..ad30d0ae6a1 100644 --- a/clang/docs/AddressSanitizer.rst +++ b/clang/docs/AddressSanitizer.rst @@ -105,12 +105,13 @@ this purpose. # endif #endif -``__attribute__((no_address_safety_analysis))`` +``__attribute__((no_sanitize_address))`` ----------------------------------------------- Some code should not be instrumented by AddressSanitizer. One may use the function attribute -:ref:`no_address_safety_analysis <langext-address_sanitizer>` +:ref:`no_sanitize_address <langext-address_sanitizer>` +(or a deprecated synonym `no_address_safety_analysis`) to disable instrumentation of a particular function. This attribute may not be supported by other compilers, so we suggest to use it together with ``__has_feature(address_sanitizer)``. Note: currently, this attribute will be diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 014e2645d86..c870d20b876 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -1616,10 +1616,38 @@ AddressSanitizer Use ``__has_feature(address_sanitizer)`` to check if the code is being built with :doc:`AddressSanitizer`. -Use ``__attribute__((no_address_safety_analysis))`` on a function declaration +Use ``__attribute__((no_sanitize_address))`` +on a function declaration to specify that address safety instrumentation (e.g. AddressSanitizer) should not be applied to that function. +.. _langext-thread_sanitizer: + +ThreadSanitizer +---------------- + +Use ``__has_feature(thread_sanitizer)`` to check if the code is being built +with :doc:`ThreadSanitizer`. + +Use ``__attribute__((no_sanitize_thread))`` on a function declaration +to specify that checks for data races on plain (non-atomic) memory accesses +should not be inserted by ThreadSanitizer. +The function may still be instrumented by the tool +to avoid false positives in other places. + +.. _langext-memory_sanitizer: + +MemorySanitizer +---------------- +Use ``__has_feature(memory_sanitizer)`` to check if the code is being built +with :doc:`MemorySanitizer`. + +Use ``__attribute__((no_sanitize_memory))`` on a function declaration +to specify that checks for uninitialized memory should not be inserted +(e.g. by MemorySanitizer). The function may still be instrumented by the tool +to avoid false positives in other places. + + Thread-Safety Annotation Checking ================================= diff --git a/clang/docs/MemorySanitizer.rst b/clang/docs/MemorySanitizer.rst index 6ede1c36e02..fdb8a810232 100644 --- a/clang/docs/MemorySanitizer.rst +++ b/clang/docs/MemorySanitizer.rst @@ -80,6 +80,19 @@ whether MemorySanitizer is enabled. :ref:`\_\_has\_feature # endif #endif +``__attribute__((no_sanitize_memory))`` +----------------------------------------------- + +Some code should not be checked by MemorySanitizer. +One may use the function attribute +:ref:`no_sanitize_memory <langext-memory_sanitizer>` +to disable uninitialized checks in a particular function. +MemorySanitizer may still instrument such functions to avoid false positives. +This attribute may not be +supported by other compilers, so we suggest to use it together with +``__has_feature(memory_sanitizer)``. Note: currently, this attribute will be +lost if the function is inlined. + Origin Tracking =============== diff --git a/clang/docs/ThreadSanitizer.rst b/clang/docs/ThreadSanitizer.rst index a7f6eb782b5..c0c576b44a5 100644 --- a/clang/docs/ThreadSanitizer.rst +++ b/clang/docs/ThreadSanitizer.rst @@ -78,10 +78,25 @@ this purpose. .. code-block:: c - #if defined(__has_feature) && __has_feature(thread_sanitizer) + #if defined(__has_feature) + # if __has_feature(thread_sanitizer) // code that builds only under ThreadSanitizer + # endif #endif +``__attribute__((no_sanitize_thread))`` +----------------------------------------------- + +Some code should not be instrumented by ThreadSanitizer. +One may use the function attribute +:ref:`no_sanitize_thread <langext-thread_sanitizer>` +to disable instrumentation of plain (non-atomic) loads/stores in a particular function. +ThreadSanitizer may still instrument such functions to avoid false positives. +This attribute may not be +supported by other compilers, so we suggest to use it together with +``__has_feature(thread_sanitizer)``. Note: currently, this attribute will be +lost if the function is inlined. + Limitations ----------- |