diff options
| author | Anna Zaks <ganna@apple.com> | 2016-09-15 21:02:18 +0000 | 
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2016-09-15 21:02:18 +0000 | 
| commit | 691644f3ca6e7b0cd3acc0cf8ddde0e200bec2ae (patch) | |
| tree | 1a0866389a84d9c65ebb5fb91501650911e317ec /compiler-rt/lib/safestack/safestack.cc | |
| parent | 592bc4553306b250efe82ad37a0824addc1bf4ba (diff) | |
| download | bcm5719-llvm-691644f3ca6e7b0cd3acc0cf8ddde0e200bec2ae.tar.gz bcm5719-llvm-691644f3ca6e7b0cd3acc0cf8ddde0e200bec2ae.zip | |
[compiler-rt] Do not introduce __sanitizer namespace globally
The definitions in sanitizer_common may conflict with definitions from system headers because:
The runtime includes the system headers after the project headers (as per LLVM coding guidelines).
lib/sanitizer_common/sanitizer_internal_defs.h pollutes the namespace of everything defined after it, which is all/most of the sanitizer .h and .cc files and the included system headers with: using namespace __sanitizer; // NOLINT
This patch solves the problem by introducing the namespace only within the sanitizer namespaces as proposed by Dmitry.
Differential Revision: https://reviews.llvm.org/D21947
llvm-svn: 281657
Diffstat (limited to 'compiler-rt/lib/safestack/safestack.cc')
| -rw-r--r-- | compiler-rt/lib/safestack/safestack.cc | 2 | 
1 files changed, 2 insertions, 0 deletions
| diff --git a/compiler-rt/lib/safestack/safestack.cc b/compiler-rt/lib/safestack/safestack.cc index 92c24b35d6d..b194b6cfa8f 100644 --- a/compiler-rt/lib/safestack/safestack.cc +++ b/compiler-rt/lib/safestack/safestack.cc @@ -92,6 +92,8 @@ static __thread void *unsafe_stack_start = nullptr;  static __thread size_t unsafe_stack_size = 0;  static __thread size_t unsafe_stack_guard = 0; +using namespace __sanitizer; +  static inline void *unsafe_stack_alloc(size_t size, size_t guard) {    CHECK_GE(size + guard, size);    void *addr = MmapOrDie(size + guard, "unsafe_stack_alloc"); | 

