OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WTF_ContainerAnnotations_h | 5 #ifndef WTF_ContainerAnnotations_h |
6 #define WTF_ContainerAnnotations_h | 6 #define WTF_ContainerAnnotations_h |
7 | 7 |
| 8 #include "wtf/AddressSanitizer.h" |
8 #include "wtf/CPU.h" | 9 #include "wtf/CPU.h" |
9 | 10 |
10 // TODO(ochang): Remove the CPU(X86_64) condition to enable this for X86 once | 11 // TODO(ochang): Remove the CPU(X86_64) condition to enable this for X86 once |
11 // the crashes there have been fixed: http://crbug.com/461406 | 12 // the crashes there have been fixed: http://crbug.com/461406 |
12 #if defined(ADDRESS_SANITIZER) && OS(LINUX) && CPU(X86_64) | 13 #if defined(ADDRESS_SANITIZER) && OS(LINUX) && CPU(X86_64) |
13 #define ANNOTATE_CONTIGUOUS_CONTAINER | 14 #define ANNOTATE_CONTIGUOUS_CONTAINER |
14 #define ANNOTATE_NEW_BUFFER(buffer, capacity, newSize) \ | 15 #define ANNOTATE_NEW_BUFFER(buffer, capacity, newSize) \ |
15 if (buffer) { \ | 16 if (buffer) { \ |
16 __sanitizer_annotate_contiguous_container(buffer, (buffer) + (capacity),
(buffer) + (capacity), (buffer) + (newSize)); \ | 17 __sanitizer_annotate_contiguous_container(buffer, (buffer) + (capacity),
(buffer) + (capacity), (buffer) + (newSize)); \ |
17 } | 18 } |
(...skipping 10 matching lines...) Expand all Loading... |
28 ANNOTATE_NEW_BUFFER(buffer, newCapacity, bufferSize); | 29 ANNOTATE_NEW_BUFFER(buffer, newCapacity, bufferSize); |
29 // Annotations require buffers to begin on an 8-byte boundary. | 30 // Annotations require buffers to begin on an 8-byte boundary. |
30 #else // defined(ADDRESS_SANITIZER) && OS(LINUX) && CPU(X86_64) | 31 #else // defined(ADDRESS_SANITIZER) && OS(LINUX) && CPU(X86_64) |
31 #define ANNOTATE_NEW_BUFFER(buffer, capacity, newSize) | 32 #define ANNOTATE_NEW_BUFFER(buffer, capacity, newSize) |
32 #define ANNOTATE_DELETE_BUFFER(buffer, capacity, oldSize) | 33 #define ANNOTATE_DELETE_BUFFER(buffer, capacity, oldSize) |
33 #define ANNOTATE_CHANGE_SIZE(buffer, capacity, oldSize, newSize) | 34 #define ANNOTATE_CHANGE_SIZE(buffer, capacity, oldSize, newSize) |
34 #define ANNOTATE_CHANGE_CAPACITY(buffer, oldCapacity, bufferSize, newCapacity) | 35 #define ANNOTATE_CHANGE_CAPACITY(buffer, oldCapacity, bufferSize, newCapacity) |
35 #endif // defined(ADDRESS_SANITIZER) && OS(LINUX) && CPU(X86_64) | 36 #endif // defined(ADDRESS_SANITIZER) && OS(LINUX) && CPU(X86_64) |
36 | 37 |
37 #endif // WTF_ContainerAnnotations_h | 38 #endif // WTF_ContainerAnnotations_h |
OLD | NEW |