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 | 074767b13f398443ad9fb441120f897997966750 (patch) | |
tree | 100678ed86288211a44ecc6b53b743c5046e719c /lib/dfsan | |
parent | b5baf5bbfbd0552b2942a7d6494a4eda9eee1854 (diff) | |
download | compiler-rt-074767b13f398443ad9fb441120f897997966750.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281657 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/dfsan')
-rw-r--r-- | lib/dfsan/dfsan.h | 3 | ||||
-rw-r--r-- | lib/dfsan/dfsan_interceptors.cc | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/dfsan/dfsan.h b/lib/dfsan/dfsan.h index 81f949e30..33145deef 100644 --- a/lib/dfsan/dfsan.h +++ b/lib/dfsan/dfsan.h @@ -18,6 +18,9 @@ #include "sanitizer_common/sanitizer_internal_defs.h" #include "dfsan_platform.h" +using __sanitizer::uptr; +using __sanitizer::u16; + // Copy declarations from public sanitizer/dfsan_interface.h header here. typedef u16 dfsan_label; diff --git a/lib/dfsan/dfsan_interceptors.cc b/lib/dfsan/dfsan_interceptors.cc index 8b7d64e25..5ecbb43e7 100644 --- a/lib/dfsan/dfsan_interceptors.cc +++ b/lib/dfsan/dfsan_interceptors.cc @@ -16,6 +16,8 @@ #include "interception/interception.h" #include "sanitizer_common/sanitizer_common.h" +using namespace __sanitizer; + INTERCEPTOR(void *, mmap, void *addr, SIZE_T length, int prot, int flags, int fd, OFF_T offset) { void *res = REAL(mmap)(addr, length, prot, flags, fd, offset); |