[PATCH] D21947: [sanitizer] Do not introduce __sanitizer namespace globally

Anna Zaks via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 1 17:24:43 PDT 2016


zaks.anna created this revision.
zaks.anna added reviewers: dvyukov, kubabrecka.
zaks.anna added subscribers: llvm-commits, kcc.
Herald added a subscriber: kubabrecka.

The definitions in sanitizer_common may conflict with definitions from system headers because:
 1. The runtime includes the system headers after the project headers (as per LLVM coding guidelines).
 2. 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.

(TODO: This needs to be tested on Linux since we do not build a few sanitizers on macOS. I'll probably have to do more cleanup once I test on Linux.)

http://reviews.llvm.org/D21947

Files:
  lib/asan/asan_interface_internal.h
  lib/asan/tests/asan_noinst_test.cc
  lib/interception/interception.h
  lib/safestack/safestack.cc
  lib/sanitizer_common/sanitizer_allocator_internal.h
  lib/sanitizer_common/sanitizer_common.h
  lib/sanitizer_common/sanitizer_common_libcdep.cc
  lib/sanitizer_common/sanitizer_coverage_libcdep.cc
  lib/sanitizer_common/sanitizer_internal_defs.h
  lib/sanitizer_common/sanitizer_mac.h
  lib/sanitizer_common/sanitizer_platform_limits_posix.cc
  lib/sanitizer_common/tests/sanitizer_libc_test.cc
  lib/sanitizer_common/tests/sanitizer_test_main.cc
  lib/tsan/rtl/tsan_interface.h
  lib/ubsan/ubsan_type_hash_itanium.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21947.62578.patch
Type: text/x-patch
Size: 8857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160702/2244f079/attachment.bin>


More information about the llvm-commits mailing list