[compiler-rt] r248966 - [compiler-rt] Apply modernize-use-nullptr fixes in sanitizers

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 17:37:40 PDT 2015


Thanks!

On Wed, Sep 30, 2015 at 5:22 PM, Vedant Kumar via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: vedantk
> Date: Wed Sep 30 19:22:21 2015
> New Revision: 248966
>
> URL: http://llvm.org/viewvc/llvm-project?rev=248966&view=rev
> Log:
> [compiler-rt] Apply modernize-use-nullptr fixes in sanitizers
>
> - Trim spaces.
> - Use nullptr in place of 0 for pointer variables.
> - Use '!p' in place of 'p == 0' for null pointer checks.
> - Add blank lines to separate function definitions.
> - Add 'extern "C"' or 'namespace foo' comments after the appropriate
>   closing brackets
>
> This is a continuation of work from 409b7b82. The focus here is on the
> various sanitizers (not sanitizer_common, as before).
>
> Patch by Eugene Zelenko!
>
> Differential Revision: http://reviews.llvm.org/D13225
>
> Modified:
>     compiler-rt/trunk/lib/asan/asan_allocator.cc
>     compiler-rt/trunk/lib/asan/asan_debugging.cc
>     compiler-rt/trunk/lib/asan/asan_fake_stack.cc
>     compiler-rt/trunk/lib/asan/asan_globals.cc
>     compiler-rt/trunk/lib/asan/asan_interceptors.cc
>     compiler-rt/trunk/lib/asan/asan_linux.cc
>     compiler-rt/trunk/lib/asan/asan_report.cc
>     compiler-rt/trunk/lib/asan/asan_rtl.cc
>     compiler-rt/trunk/lib/asan/asan_stack.h
>     compiler-rt/trunk/lib/asan/asan_thread.cc
>     compiler-rt/trunk/lib/asan/asan_thread.h
>     compiler-rt/trunk/lib/dfsan/dfsan_custom.cc
>     compiler-rt/trunk/lib/lsan/lsan_allocator.cc
>     compiler-rt/trunk/lib/lsan/lsan_common.cc
>     compiler-rt/trunk/lib/lsan/lsan_common_linux.cc
>     compiler-rt/trunk/lib/lsan/lsan_interceptors.cc
>     compiler-rt/trunk/lib/lsan/lsan_thread.cc
>     compiler-rt/trunk/lib/msan/msan.cc
>     compiler-rt/trunk/lib/msan/msan_allocator.cc
>     compiler-rt/trunk/lib/msan/msan_chained_origin_depot.cc
>     compiler-rt/trunk/lib/msan/msan_interceptors.cc
>     compiler-rt/trunk/lib/msan/msan_linux.cc
>     compiler-rt/trunk/lib/msan/msan_thread.h
>     compiler-rt/trunk/lib/safestack/safestack.cc
>
> Modified: compiler-rt/trunk/lib/asan/asan_allocator.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_allocator.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_allocator.cc Wed Sep 30 19:22:21 2015
> @@ -14,8 +14,8 @@
>  // with ThreadSanitizer and MemorySanitizer.
>  //
>
>  //===----------------------------------------------------------------------===//
> -#include "asan_allocator.h"
>
> +#include "asan_allocator.h"
>  #include "asan_mapping.h"
>  #include "asan_poisoning.h"
>  #include "asan_report.h"
> @@ -541,7 +541,7 @@ struct Allocator {
>        u8 chunk_state = m->chunk_state;
>        if (chunk_state != CHUNK_ALLOCATED)
>          ReportInvalidFree(old_ptr, chunk_state, stack);
> -      CHECK_NE(REAL(memcpy), (void*)0);
> +      CHECK_NE(REAL(memcpy), nullptr);
>        uptr memcpy_size = Min(new_size, m->UsedSize());
>        // If realloc() races with free(), we may start copying freed
> memory.
>        // However, we will report racy double-free later anyway.
> @@ -579,7 +579,7 @@ struct Allocator {
>
>    // Assumes alloc_beg == allocator.GetBlockBegin(alloc_beg).
>    AsanChunk *GetAsanChunk(void *alloc_beg) {
> -    if (!alloc_beg) return 0;
> +    if (!alloc_beg) return nullptr;
>      if (!allocator.FromPrimary(alloc_beg)) {
>        uptr *meta = reinterpret_cast<uptr
> *>(allocator.GetMetaData(alloc_beg));
>        AsanChunk *m = reinterpret_cast<AsanChunk *>(meta[1]);
> @@ -619,7 +619,7 @@ struct Allocator {
>        // The address is in the chunk's left redzone, so maybe it is
> actually
>        // a right buffer overflow from the other chunk to the left.
>        // Search a bit to the left to see if there is another chunk.
> -      AsanChunk *m2 = 0;
> +      AsanChunk *m2 = nullptr;
>        for (uptr l = 1; l < GetPageSizeCached(); l++) {
>          m2 = GetAsanChunkByAddr(addr - l);
>          if (m2 == m1) continue;  // Still the same chunk.
> @@ -653,7 +653,7 @@ static AsanAllocator &get_allocator() {
>  }
>
>  bool AsanChunkView::IsValid() {
> -  return chunk_ != 0 && chunk_->chunk_state != CHUNK_AVAILABLE;
> +  return chunk_ && chunk_->chunk_state != CHUNK_AVAILABLE;
>  }
>  uptr AsanChunkView::Beg() { return chunk_->Beg(); }
>  uptr AsanChunkView::End() { return Beg() + UsedSize(); }
> @@ -723,11 +723,11 @@ void *asan_calloc(uptr nmemb, uptr size,
>  }
>
>  void *asan_realloc(void *p, uptr size, BufferedStackTrace *stack) {
> -  if (p == 0)
> +  if (!p)
>      return instance.Allocate(size, 8, stack, FROM_MALLOC, true);
>    if (size == 0) {
>      instance.Deallocate(p, 0, stack, FROM_MALLOC);
> -    return 0;
> +    return nullptr;
>    }
>    return instance.Reallocate(p, size, stack);
>  }
> @@ -755,7 +755,7 @@ int asan_posix_memalign(void **memptr, u
>  }
>
>  uptr asan_malloc_usable_size(void *ptr, uptr pc, uptr bp) {
> -  if (ptr == 0) return 0;
> +  if (!ptr) return 0;
>    uptr usable_size = instance.AllocationSize(reinterpret_cast<uptr>(ptr));
>    if (flags()->check_malloc_usable_size && (usable_size == 0)) {
>      GET_STACK_TRACE_FATAL(pc, bp);
> @@ -780,7 +780,7 @@ void AsanSoftRssLimitExceededCallback(bo
>    instance.allocator.SetRssLimitIsExceeded(exceeded);
>  }
>
> -}  // namespace __asan
> +} // namespace __asan
>
>  // --- Implementation of LSan-specific functions --- {{{1
>  namespace __lsan {
> @@ -881,7 +881,7 @@ int __sanitizer_get_ownership(const void
>  }
>
>  uptr __sanitizer_get_allocated_size(const void *p) {
> -  if (p == 0) return 0;
> +  if (!p) return 0;
>    uptr ptr = reinterpret_cast<uptr>(p);
>    uptr allocated_size = instance.AllocationSize(ptr);
>    // Die if p is not malloced or if it is already freed.
> @@ -904,5 +904,5 @@ SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_
>  void __sanitizer_free_hook(void *ptr) {
>    (void)ptr;
>  }
> -}  // extern "C"
> +} // extern "C"
>  #endif
>
> Modified: compiler-rt/trunk/lib/asan/asan_debugging.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_debugging.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_debugging.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_debugging.cc Wed Sep 30 19:22:21 2015
> @@ -108,14 +108,14 @@ static uptr AsanGetStack(uptr addr, uptr
>    return 0;
>  }
>
> -}  // namespace __asan
> +} // namespace __asan
>
>  using namespace __asan;
>
>  SANITIZER_INTERFACE_ATTRIBUTE
>  const char *__asan_locate_address(uptr addr, char *name, uptr name_size,
>                                    uptr *region_address, uptr
> *region_size) {
> -  AddressDescription descr = { name, name_size, 0, 0, 0 };
> +  AddressDescription descr = { name, name_size, 0, 0, nullptr };
>    AsanLocateAddress(addr, &descr);
>    if (region_address) *region_address = descr.region_address;
>    if (region_size) *region_size = descr.region_size;
>
> Modified: compiler-rt/trunk/lib/asan/asan_fake_stack.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_fake_stack.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_fake_stack.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_fake_stack.cc Wed Sep 30 19:22:21 2015
> @@ -11,6 +11,7 @@
>  //
>  // FakeStack is used to detect use-after-return bugs.
>
>  //===----------------------------------------------------------------------===//
> +
>  #include "asan_allocator.h"
>  #include "asan_poisoning.h"
>  #include "asan_thread.h"
> @@ -32,7 +33,7 @@ ALWAYS_INLINE void SetShadow(uptr ptr, u
>    if (class_id <= 6) {
>      for (uptr i = 0; i < (1U << class_id); i++) {
>        shadow[i] = magic;
> -      SanitizerBreakOptimization(0);  // Make sure this does not become
> memset.
> +      SanitizerBreakOptimization(nullptr);  // Make sure this does not
> become memset.
>      }
>    } else {
>      // The size class is too big, it's cheaper to poison only size bytes.
> @@ -108,7 +109,7 @@ FakeFrame *FakeStack::Allocate(uptr stac
>      *SavedFlagPtr(reinterpret_cast<uptr>(res), class_id) = &flags[pos];
>      return res;
>    }
> -  return 0; // We are out of fake stack.
> +  return nullptr; // We are out of fake stack.
>  }
>
>  uptr FakeStack::AddrIsInFakeStack(uptr ptr, uptr *frame_beg, uptr
> *frame_end) {
> @@ -185,7 +186,7 @@ void SetTLSFakeStack(FakeStack *fs) { }
>
>  static FakeStack *GetFakeStack() {
>    AsanThread *t = GetCurrentThread();
> -  if (!t) return 0;
> +  if (!t) return nullptr;
>    return t->fake_stack();
>  }
>
> @@ -193,7 +194,7 @@ static FakeStack *GetFakeStackFast() {
>    if (FakeStack *fs = GetTLSFakeStack())
>      return fs;
>    if (!__asan_option_detect_stack_use_after_return)
> -    return 0;
> +    return nullptr;
>    return GetFakeStack();
>  }
>
> @@ -214,7 +215,7 @@ ALWAYS_INLINE void OnFree(uptr ptr, uptr
>    SetShadow(ptr, size, class_id, kMagic8);
>  }
>
> -}  // namespace __asan
> +} // namespace __asan
>
>  // ---------------------- Interface ---------------- {{{1
>  using namespace __asan;
> @@ -247,13 +248,13 @@ SANITIZER_INTERFACE_ATTRIBUTE
>  void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void
> **beg,
>                                     void **end) {
>    FakeStack *fs = reinterpret_cast<FakeStack*>(fake_stack);
> -  if (!fs) return 0;
> +  if (!fs) return nullptr;
>    uptr frame_beg, frame_end;
>    FakeFrame *frame = reinterpret_cast<FakeFrame *>(fs->AddrIsInFakeStack(
>        reinterpret_cast<uptr>(addr), &frame_beg, &frame_end));
> -  if (!frame) return 0;
> +  if (!frame) return nullptr;
>    if (frame->magic != kCurrentStackFrameMagic)
> -    return 0;
> +    return nullptr;
>    if (beg) *beg = reinterpret_cast<void*>(frame_beg);
>    if (end) *end = reinterpret_cast<void*>(frame_end);
>    return reinterpret_cast<void*>(frame->real_stack);
> @@ -278,4 +279,4 @@ void __asan_allocas_unpoison(uptr top, u
>    REAL(memset)(reinterpret_cast<void*>(MemToShadow(top)), 0,
>                 (bottom - top) / SHADOW_GRANULARITY);
>  }
> -}  // extern "C"
> +} // extern "C"
>
> Modified: compiler-rt/trunk/lib/asan/asan_globals.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_globals.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_globals.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_globals.cc Wed Sep 30 19:22:21 2015
> @@ -11,6 +11,7 @@
>  //
>  // Handle globals.
>
>  //===----------------------------------------------------------------------===//
> +
>  #include "asan_interceptors.h"
>  #include "asan_internal.h"
>  #include "asan_mapping.h"
> @@ -167,7 +168,7 @@ static void RegisterGlobal(const Global
>    l->next = list_of_all_globals;
>    list_of_all_globals = l;
>    if (g->has_dynamic_init) {
> -    if (dynamic_init_globals == 0) {
> +    if (!dynamic_init_globals) {
>        dynamic_init_globals = new(allocator_for_globals)
>            VectorOfGlobals(kDynamicInitGlobalsInitialCapacity);
>      }
> @@ -206,7 +207,7 @@ void StopInitOrderChecking() {
>    }
>  }
>
> -}  // namespace __asan
> +} // namespace __asan
>
>  // ---------------------- Interface ---------------- {{{1
>  using namespace __asan;  // NOLINT
>
> Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Wed Sep 30 19:22:21
> 2015
> @@ -11,8 +11,8 @@
>  //
>  // Intercept various libc functions.
>
>  //===----------------------------------------------------------------------===//
> -#include "asan_interceptors.h"
>
> +#include "asan_interceptors.h"
>  #include "asan_allocator.h"
>  #include "asan_internal.h"
>  #include "asan_mapping.h"
> @@ -109,7 +109,7 @@ static inline bool RangesOverlap(const c
>
>  static inline uptr MaybeRealStrnlen(const char *s, uptr maxlen) {
>  #if ASAN_INTERCEPT_STRNLEN
> -  if (REAL(strnlen) != 0) {
> +  if (REAL(strnlen)) {
>      return REAL(strnlen)(s, maxlen);
>    }
>  #endif
> @@ -127,7 +127,7 @@ int OnExit() {
>    return 0;
>  }
>
> -}  // namespace __asan
> +} // namespace __asan
>
>  // ---------------------- Wrappers ---------------- {{{1
>  using namespace __asan;  // NOLINT
> @@ -220,7 +220,7 @@ static thread_return_t THREAD_CALLING_CO
>    ThreadStartParam *param = reinterpret_cast<ThreadStartParam *>(arg);
>    AsanThread *t = nullptr;
>    while ((t = reinterpret_cast<AsanThread *>(
> -              atomic_load(&param->t, memory_order_acquire))) == 0)
> +              atomic_load(&param->t, memory_order_acquire))) == nullptr)
>      internal_sched_yield();
>    SetCurrentThread(t);
>    return t->ThreadStart(GetTid(), &param->is_registered);
> @@ -235,7 +235,7 @@ INTERCEPTOR(int, pthread_create, void *t
>      StopInitOrderChecking();
>    GET_STACK_TRACE_THREAD;
>    int detached = 0;
> -  if (attr != 0)
> +  if (attr)
>      REAL(pthread_attr_getdetachstate)(attr, &detached);
>    ThreadStartParam param;
>    atomic_store(&param.t, 0, memory_order_relaxed);
> @@ -280,7 +280,7 @@ INTERCEPTOR(void*, signal, int signum, v
>    if (!IsDeadlySignal(signum) || common_flags()->allow_user_segv_handler)
> {
>      return REAL(signal)(signum, handler);
>    }
> -  return 0;
> +  return nullptr;
>  }
>
>  INTERCEPTOR(int, sigaction, int signum, const struct sigaction *act,
> @@ -296,7 +296,7 @@ int real_sigaction(int signum, const voi
>    return REAL(sigaction)(signum, (const struct sigaction *)act,
>                           (struct sigaction *)oldact);
>  }
> -}  // namespace __sanitizer
> +} // namespace __sanitizer
>
>  #elif SANITIZER_POSIX
>  // We need to have defined REAL(sigaction) on posix systems.
> @@ -713,7 +713,7 @@ INTERCEPTOR(int, __cxa_atexit, void (*fu
>  #endif
>    ENSURE_ASAN_INITED();
>    int res = REAL(__cxa_atexit)(func, arg, dso_handle);
> -  REAL(__cxa_atexit)(AtCxaAtexit, 0, 0);
> +  REAL(__cxa_atexit)(AtCxaAtexit, nullptr, nullptr);
>    return res;
>  }
>  #endif  // ASAN_INTERCEPT___CXA_ATEXIT
> @@ -817,4 +817,4 @@ void InitializeAsanInterceptors() {
>    VReport(1, "AddressSanitizer: libc interceptors initialized\n");
>  }
>
> -}  // namespace __asan
> +} // namespace __asan
>
> Modified: compiler-rt/trunk/lib/asan/asan_linux.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_linux.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_linux.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_linux.cc Wed Sep 30 19:22:21 2015
> @@ -117,7 +117,7 @@ void AsanCheckDynamicRTPrereqs() {
>      return;
>
>    // Ensure that dynamic RT is the first DSO in the list
> -  const char *first_dso_name = 0;
> +  const char *first_dso_name = nullptr;
>    dl_iterate_phdr(FindFirstDSOCallback, &first_dso_name);
>    if (first_dso_name && !IsDynamicRTName(first_dso_name)) {
>      Report("ASan runtime does not come first in initial library list; "
> @@ -142,7 +142,8 @@ void AsanCheckIncompatibleRT() {
>        // system libraries, causing crashes later in ASan initialization.
>        MemoryMappingLayout proc_maps(/*cache_enabled*/true);
>        char filename[128];
> -      while (proc_maps.Next(0, 0, 0, filename, sizeof(filename), 0)) {
> +      while (proc_maps.Next(nullptr, nullptr, nullptr, filename,
> +                            sizeof(filename), nullptr)) {
>          if (IsDynamicRTName(filename)) {
>            Report("Your application is linked against "
>                   "incompatible ASan runtimes.\n");
> @@ -155,7 +156,7 @@ void AsanCheckIncompatibleRT() {
>      }
>    }
>  }
> -#endif  // SANITIZER_ANDROID
> +#endif // SANITIZER_ANDROID
>
>  #if !SANITIZER_ANDROID
>  void ReadContextStack(void *context, uptr *stack, uptr *ssize) {
> @@ -173,6 +174,6 @@ void *AsanDlSymNext(const char *sym) {
>    return dlsym(RTLD_NEXT, sym);
>  }
>
> -}  // namespace __asan
> +} // namespace __asan
>
> -#endif  // SANITIZER_FREEBSD || SANITIZER_LINUX
> +#endif // SANITIZER_FREEBSD || SANITIZER_LINUX
>
> Modified: compiler-rt/trunk/lib/asan/asan_report.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_report.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_report.cc Wed Sep 30 19:22:21 2015
> @@ -11,6 +11,7 @@
>  //
>  // This file contains error reporting code.
>
>  //===----------------------------------------------------------------------===//
> +
>  #include "asan_flags.h"
>  #include "asan_internal.h"
>  #include "asan_mapping.h"
> @@ -27,7 +28,7 @@ namespace __asan {
>
>  // -------------------- User-specified callbacks ----------------- {{{1
>  static void (*error_report_callback)(const char*);
> -static char *error_message_buffer = 0;
> +static char *error_message_buffer = nullptr;
>  static uptr error_message_buffer_pos = 0;
>  static uptr error_message_buffer_size = 0;
>
> @@ -373,7 +374,7 @@ static void PrintAccessAndVarIntersectio
>                                            uptr next_var_beg) {
>    uptr var_end = var.beg + var.size;
>    uptr addr_end = addr + access_size;
> -  const char *pos_descr = 0;
> +  const char *pos_descr = nullptr;
>    // If the variable [var.beg, var_end) is the nearest variable to the
>    // current memory access, indicate it in the log.
>    if (addr >= var.beg) {
> @@ -544,7 +545,7 @@ void DescribeHeapAddress(uptr addr, uptr
>    StackTrace alloc_stack = chunk.GetAllocStack();
>    char tname[128];
>    Decorator d;
> -  AsanThreadContext *free_thread = 0;
> +  AsanThreadContext *free_thread = nullptr;
>    if (chunk.FreeTid() != kInvalidTid) {
>      free_thread = GetThreadContextByTidLocked(chunk.FreeTid());
>      Printf("%sfreed by thread T%d%s here:%s\n", d.Allocation(),
> @@ -958,7 +959,7 @@ void ReportMacCfReallocUnknown(uptr addr
>    DescribeHeapAddress(addr, 1);
>  }
>
> -}  // namespace __asan
> +} // namespace __asan
>
>  // --------------------------- Interface --------------------- {{{1
>  using namespace __asan;  // NOLINT
> @@ -1117,7 +1118,7 @@ SANITIZER_INTERFACE_ATTRIBUTE
>  void __sanitizer_ptr_cmp(void *a, void *b) {
>    CheckForInvalidPointerPair(a, b);
>  }
> -}  // extern "C"
> +} // extern "C"
>
>  #if !SANITIZER_SUPPORTS_WEAK_HOOKS
>  // Provide default implementation of __asan_on_error that does nothing
>
> Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_rtl.cc Wed Sep 30 19:22:21 2015
> @@ -11,6 +11,7 @@
>  //
>  // Main file of the ASan run-time library.
>
>  //===----------------------------------------------------------------------===//
> +
>  #include "asan_activation.h"
>  #include "asan_allocator.h"
>  #include "asan_interceptors.h"
> @@ -254,15 +255,15 @@ static NOINLINE void force_interface_sym
>      case 22: __asan_report_exp_store8(0, 0); break;
>      case 23: __asan_report_exp_store16(0, 0); break;
>      case 24: __asan_report_exp_store_n(0, 0, 0); break;
> -    case 25: __asan_register_globals(0, 0); break;
> -    case 26: __asan_unregister_globals(0, 0); break;
> -    case 27: __asan_set_death_callback(0); break;
> -    case 28: __asan_set_error_report_callback(0); break;
> +    case 25: __asan_register_globals(nullptr, 0); break;
> +    case 26: __asan_unregister_globals(nullptr, 0); break;
> +    case 27: __asan_set_death_callback(nullptr); break;
> +    case 28: __asan_set_error_report_callback(nullptr); break;
>      case 29: __asan_handle_no_return(); break;
> -    case 30: __asan_address_is_poisoned(0); break;
> -    case 31: __asan_poison_memory_region(0, 0); break;
> -    case 32: __asan_unpoison_memory_region(0, 0); break;
> -    case 34: __asan_before_dynamic_init(0); break;
> +    case 30: __asan_address_is_poisoned(nullptr); break;
> +    case 31: __asan_poison_memory_region(nullptr, 0); break;
> +    case 32: __asan_unpoison_memory_region(nullptr, 0); break;
> +    case 34: __asan_before_dynamic_init(nullptr); break;
>      case 35: __asan_after_dynamic_init(); break;
>      case 36: __asan_poison_stack_memory(0, 0); break;
>      case 37: __asan_unpoison_stack_memory(0, 0); break;
> @@ -541,7 +542,7 @@ public:  // NOLINT
>  static AsanInitializer asan_initializer;
>  #endif  // ASAN_DYNAMIC
>
> -}  // namespace __asan
> +} // namespace __asan
>
>  // ---------------------- Interface ---------------- {{{1
>  using namespace __asan;  // NOLINT
>
> Modified: compiler-rt/trunk/lib/asan/asan_stack.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stack.h?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_stack.h (original)
> +++ compiler-rt/trunk/lib/asan/asan_stack.h Wed Sep 30 19:22:21 2015
> @@ -11,6 +11,7 @@
>  //
>  // ASan-private header for asan_stack.cc.
>
>  //===----------------------------------------------------------------------===//
> +
>  #ifndef ASAN_STACK_H
>  #define ASAN_STACK_H
>
> @@ -48,15 +49,15 @@ void GetStackTraceWithPcBpAndContext(Buf
>        uptr stack_bottom = t->stack_bottom();
>        ScopedUnwinding unwind_scope(t);
>        stack->Unwind(max_depth, pc, bp, context, stack_top, stack_bottom,
> fast);
> -    } else if (t == 0 && !fast) {
> +    } else if (!t && !fast) {
>        /* If GetCurrentThread() has failed, try to do slow unwind anyways.
> */
>        stack->Unwind(max_depth, pc, bp, context, 0, 0, false);
>      }
>    }
> -#endif  // SANITIZER_WINDOWS
> +#endif // SANITIZER_WINDOWS
>  }
>
> -}  // namespace __asan
> +} // namespace __asan
>
>  // NOTE: A Rule of thumb is to retrieve stack trace in the interceptors
>  // as early as possible (in functions exposed to the user), as we
> generally
> @@ -115,4 +116,4 @@ void GetStackTraceWithPcBpAndContext(Buf
>      stack.Print();                  \
>    }
>
> -#endif  // ASAN_STACK_H
> +#endif // ASAN_STACK_H
>
> Modified: compiler-rt/trunk/lib/asan/asan_thread.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_thread.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_thread.cc Wed Sep 30 19:22:21 2015
> @@ -42,7 +42,7 @@ void AsanThreadContext::OnCreated(void *
>
>  void AsanThreadContext::OnFinished() {
>    // Drop the link to the AsanThread object.
> -  thread = 0;
> +  thread = nullptr;
>  }
>
>  // MIPS requires aligned address
> @@ -125,7 +125,7 @@ void AsanThread::Destroy() {
>  FakeStack *AsanThread::AsyncSignalSafeLazyInitFakeStack() {
>    uptr stack_size = this->stack_size();
>    if (stack_size == 0)  // stack_size is not yet available, don't use
> FakeStack.
> -    return 0;
> +    return nullptr;
>    uptr old_val = 0;
>    // fake_stack_ has 3 states:
>    // 0   -- not initialized
> @@ -146,11 +146,11 @@ FakeStack *AsanThread::AsyncSignalSafeLa
>      SetTLSFakeStack(fake_stack_);
>      return fake_stack_;
>    }
> -  return 0;
> +  return nullptr;
>  }
>
>  void AsanThread::Init() {
> -  fake_stack_ = 0;  // Will be initialized lazily if needed.
> +  fake_stack_ = nullptr;  // Will be initialized lazily if needed.
>    CHECK_EQ(this->stack_size(), 0U);
>    SetThreadStackAndTls();
>    CHECK_GT(this->stack_size(), 0U);
> @@ -166,7 +166,7 @@ void AsanThread::Init() {
>  thread_return_t AsanThread::ThreadStart(
>      uptr os_id, atomic_uintptr_t *signal_thread_is_registered) {
>    Init();
> -  asanThreadRegistry().StartThread(tid(), os_id, 0);
> +  asanThreadRegistry().StartThread(tid(), os_id, nullptr);
>    if (signal_thread_is_registered)
>      atomic_store(signal_thread_is_registered, 1, memory_order_release);
>
> @@ -276,7 +276,7 @@ AsanThread *GetCurrentThread() {
>          return tctx->thread;
>        }
>      }
> -    return 0;
> +    return nullptr;
>    }
>    return context->thread;
>  }
> @@ -301,7 +301,7 @@ AsanThread *FindThreadByStackAddress(upt
>    AsanThreadContext *tctx = static_cast<AsanThreadContext *>(
>
>  asanThreadRegistry().FindThreadContextLocked(ThreadStackContainsAddress,
>                                                     (void *)addr));
> -  return tctx ? tctx->thread : 0;
> +  return tctx ? tctx->thread : nullptr;
>  }
>
>  void EnsureMainThreadIDIsCorrect() {
> @@ -314,10 +314,10 @@ void EnsureMainThreadIDIsCorrect() {
>  __asan::AsanThread *GetAsanThreadByOsIDLocked(uptr os_id) {
>    __asan::AsanThreadContext *context =
> static_cast<__asan::AsanThreadContext *>(
>        __asan::asanThreadRegistry().FindThreadContextByOsIDLocked(os_id));
> -  if (!context) return 0;
> +  if (!context) return nullptr;
>    return context->thread;
>  }
> -}  // namespace __asan
> +} // namespace __asan
>
>  // --- Implementation of LSan-specific functions --- {{{1
>  namespace __lsan {
> @@ -354,4 +354,4 @@ void UnlockThreadRegistry() {
>  void EnsureMainThreadIDIsCorrect() {
>    __asan::EnsureMainThreadIDIsCorrect();
>  }
> -}  // namespace __lsan
> +} // namespace __lsan
>
> Modified: compiler-rt/trunk/lib/asan/asan_thread.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.h?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_thread.h (original)
> +++ compiler-rt/trunk/lib/asan/asan_thread.h Wed Sep 30 19:22:21 2015
> @@ -11,6 +11,7 @@
>  //
>  // ASan-private header for asan_thread.cc.
>
>  //===----------------------------------------------------------------------===//
> +
>  #ifndef ASAN_THREAD_H
>  #define ASAN_THREAD_H
>
> @@ -36,7 +37,7 @@ class AsanThreadContext : public ThreadC
>    explicit AsanThreadContext(int tid)
>        : ThreadContextBase(tid), announced(false),
>          destructor_iterations(GetPthreadDestructorIterations()),
> stack_id(0),
> -        thread(0) {}
> +        thread(nullptr) {}
>    bool announced;
>    u8 destructor_iterations;
>    u32 stack_id;
> @@ -84,8 +85,8 @@ class AsanThread {
>    void DeleteFakeStack(int tid) {
>      if (!fake_stack_) return;
>      FakeStack *t = fake_stack_;
> -    fake_stack_ = 0;
> -    SetTLSFakeStack(0);
> +    fake_stack_ = nullptr;
> +    SetTLSFakeStack(nullptr);
>      t->Destroy(tid);
>    }
>
> @@ -95,7 +96,7 @@ class AsanThread {
>
>    FakeStack *fake_stack() {
>      if (!__asan_option_detect_stack_use_after_return)
> -      return 0;
> +      return nullptr;
>      if (!has_fake_stack())
>        return AsyncSignalSafeLazyInitFakeStack();
>      return fake_stack_;
> @@ -179,6 +180,6 @@ AsanThread *FindThreadByStackAddress(upt
>
>  // Used to handle fork().
>  void EnsureMainThreadIDIsCorrect();
> -}  // namespace __asan
> +} // namespace __asan
>
> -#endif  // ASAN_THREAD_H
> +#endif // ASAN_THREAD_H
>
> Modified: compiler-rt/trunk/lib/dfsan/dfsan_custom.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/dfsan_custom.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/dfsan/dfsan_custom.cc (original)
> +++ compiler-rt/trunk/lib/dfsan/dfsan_custom.cc Wed Sep 30 19:22:21 2015
> @@ -85,7 +85,7 @@ SANITIZER_INTERFACE_ATTRIBUTE char *__df
>          *ret_label = dfsan_union(dfsan_read_label(s, i + 1),
>                                   dfsan_union(s_label, c_label));
>        }
> -      return s[i] == 0 ? 0 : const_cast<char *>(s+i);
> +      return s[i] == 0 ? nullptr : const_cast<char *>(s+i);
>      }
>    }
>  }
> @@ -848,8 +848,8 @@ typedef void (*write_trampoline_t)(
>  // Calls to dfsan_set_write_callback() set the values in this struct.
>  // Calls to the custom version of write() read (and invoke) them.
>  static struct {
> -  write_trampoline_t write_callback_trampoline = NULL;
> -  void *write_callback = NULL;
> +  write_trampoline_t write_callback_trampoline = nullptr;
> +  void *write_callback = nullptr;
>  } write_callback_info;
>
>  SANITIZER_INTERFACE_ATTRIBUTE void
> @@ -866,7 +866,7 @@ SANITIZER_INTERFACE_ATTRIBUTE int
>  __dfsw_write(int fd, const void *buf, size_t count,
>               dfsan_label fd_label, dfsan_label buf_label,
>               dfsan_label count_label, dfsan_label *ret_label) {
> -  if (write_callback_info.write_callback != NULL) {
> +  if (write_callback_info.write_callback) {
>      write_callback_info.write_callback_trampoline(
>          write_callback_info.write_callback,
>          fd, buf, count,
> @@ -876,7 +876,7 @@ __dfsw_write(int fd, const void *buf, si
>    *ret_label = 0;
>    return write(fd, buf, count);
>  }
> -}
> +} // namespace __dfsan
>
>  // Type used to extract a dfsan_label with va_arg()
>  typedef int dfsan_label_va;
> @@ -1132,4 +1132,4 @@ int __dfsw_snprintf(char *str, size_t si
>    va_end(ap);
>    return ret;
>  }
> -}
> +} // extern "C"
>
> Modified: compiler-rt/trunk/lib/lsan/lsan_allocator.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_allocator.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/lsan/lsan_allocator.cc (original)
> +++ compiler-rt/trunk/lib/lsan/lsan_allocator.cc Wed Sep 30 19:22:21 2015
> @@ -91,7 +91,7 @@ void *Allocate(const StackTrace &stack,
>      size = 1;
>    if (size > kMaxAllowedMallocSize) {
>      Report("WARNING: LeakSanitizer failed to allocate %zu bytes\n", size);
> -    return 0;
> +    return nullptr;
>    }
>    void *p = allocator.Allocate(&cache, size, alignment, false);
>    // Do not rely on the allocator to clear the memory (it's slow).
> @@ -114,7 +114,7 @@ void *Reallocate(const StackTrace &stack
>    if (new_size > kMaxAllowedMallocSize) {
>      Report("WARNING: LeakSanitizer failed to allocate %zu bytes\n",
> new_size);
>      allocator.Deallocate(&cache, p);
> -    return 0;
> +    return nullptr;
>    }
>    p = allocator.Reallocate(&cache, p, new_size, alignment);
>    RegisterAllocation(stack, p, new_size);
> @@ -212,7 +212,7 @@ IgnoreObjectResult IgnoreObjectLocked(co
>      return kIgnoreObjectInvalid;
>    }
>  }
> -}  // namespace __lsan
> +} // namespace __lsan
>
>  using namespace __lsan;
>
> @@ -241,10 +241,10 @@ SANITIZER_INTERFACE_ATTRIBUTE
>  uptr __sanitizer_get_estimated_allocated_size(uptr size) { return size; }
>
>  SANITIZER_INTERFACE_ATTRIBUTE
> -int __sanitizer_get_ownership(const void *p) { return Metadata(p) != 0; }
> +int __sanitizer_get_ownership(const void *p) { return Metadata(p) !=
> nullptr; }
>
>  SANITIZER_INTERFACE_ATTRIBUTE
>  uptr __sanitizer_get_allocated_size(const void *p) {
>    return GetMallocUsableSize(p);
>  }
> -}  // extern "C"
> +} // extern "C"
>
> Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
> +++ compiler-rt/trunk/lib/lsan/lsan_common.cc Wed Sep 30 19:22:21 2015
> @@ -243,8 +243,8 @@ static void ProcessRootRegion(Frontier *
>    MemoryMappingLayout proc_maps(/*cache_enabled*/true);
>    uptr begin, end, prot;
>    while (proc_maps.Next(&begin, &end,
> -                        /*offset*/ 0, /*filename*/ 0, /*filename_size*/ 0,
> -                        &prot)) {
> +                        /*offset*/ nullptr, /*filename*/ nullptr,
> +                        /*filename_size*/ 0, &prot)) {
>      uptr intersection_begin = Max(root_begin, begin);
>      uptr intersection_end = Min(end, root_end);
>      if (intersection_begin >= intersection_end) continue;
> @@ -484,7 +484,7 @@ static Suppression *GetSuppressionForSta
>          StackTrace::GetPreviousInstructionPc(stack.trace[i]));
>      if (s) return s;
>    }
> -  return 0;
> +  return nullptr;
>  }
>
>  ///// LeakReport implementation. /////
> @@ -612,8 +612,8 @@ uptr LeakReport::UnsuppressedLeakCount()
>    return result;
>  }
>
> -}  // namespace __lsan
> -#endif  // CAN_SANITIZE_LEAKS
> +} // namespace __lsan
> +#endif // CAN_SANITIZE_LEAKS
>
>  using namespace __lsan;  // NOLINT
>
> @@ -634,7 +634,7 @@ void __lsan_ignore_object(const void *p)
>             "heap object at %p is already being ignored\n", p);
>    if (res == kIgnoreObjectSuccess)
>      VReport(1, "__lsan_ignore_object(): ignoring heap object at %p\n", p);
> -#endif  // CAN_SANITIZE_LEAKS
> +#endif // CAN_SANITIZE_LEAKS
>  }
>
>  SANITIZER_INTERFACE_ATTRIBUTE
> @@ -645,7 +645,7 @@ void __lsan_register_root_region(const v
>    RootRegion region = {begin, size};
>    root_regions->push_back(region);
>    VReport(1, "Registered root region at %p of size %llu\n", begin, size);
> -#endif  // CAN_SANITIZE_LEAKS
> +#endif // CAN_SANITIZE_LEAKS
>  }
>
>  SANITIZER_INTERFACE_ATTRIBUTE
> @@ -672,7 +672,7 @@ void __lsan_unregister_root_region(const
>          begin, size);
>      Die();
>    }
> -#endif  // CAN_SANITIZE_LEAKS
> +#endif // CAN_SANITIZE_LEAKS
>  }
>
>  SANITIZER_INTERFACE_ATTRIBUTE
> @@ -698,7 +698,7 @@ void __lsan_do_leak_check() {
>  #if CAN_SANITIZE_LEAKS
>    if (common_flags()->detect_leaks)
>      __lsan::DoLeakCheck();
> -#endif  // CAN_SANITIZE_LEAKS
> +#endif // CAN_SANITIZE_LEAKS
>  }
>
>  SANITIZER_INTERFACE_ATTRIBUTE
> @@ -706,7 +706,7 @@ int __lsan_do_recoverable_leak_check() {
>  #if CAN_SANITIZE_LEAKS
>    if (common_flags()->detect_leaks)
>      return __lsan::DoRecoverableLeakCheck();
> -#endif  // CAN_SANITIZE_LEAKS
> +#endif // CAN_SANITIZE_LEAKS
>    return 0;
>  }
>
> @@ -716,4 +716,4 @@ int __lsan_is_turned_off() {
>    return 0;
>  }
>  #endif
> -}  // extern "C"
> +} // extern "C"
>
> Modified: compiler-rt/trunk/lib/lsan/lsan_common_linux.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common_linux.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/lsan/lsan_common_linux.cc (original)
> +++ compiler-rt/trunk/lib/lsan/lsan_common_linux.cc Wed Sep 30 19:22:21
> 2015
> @@ -29,7 +29,7 @@ static const char kLinkerName[] = "ld";
>  // We request 2 modules matching "ld", so we can print a warning if
> there's more
>  // than one match. But only the first one is actually used.
>  static char linker_placeholder[2 * sizeof(LoadedModule)] ALIGNED(64);
> -static LoadedModule *linker = 0;
> +static LoadedModule *linker = nullptr;
>
>  static bool IsLinker(const char* full_name) {
>    return LibraryNameIs(full_name, kLinkerName);
> @@ -49,7 +49,7 @@ void InitializePlatformSpecificModules()
>    else if (num_matches > 1)
>      VReport(1, "LeakSanitizer: Multiple modules match \"%s\". "
>              "TLS will not be handled correctly.\n", kLinkerName);
> -  linker = 0;
> +  linker = nullptr;
>  }
>
>  static int ProcessGlobalRegionsCallback(struct dl_phdr_info *info, size_t
> size,
> @@ -174,5 +174,6 @@ void DoStopTheWorld(StopTheWorldCallback
>    dl_iterate_phdr(DoStopTheWorldCallback, &param);
>  }
>
> -}  // namespace __lsan
> -#endif  // CAN_SANITIZE_LEAKS && SANITIZER_LINUX
> +} // namespace __lsan
> +
> +#endif // CAN_SANITIZE_LEAKS && SANITIZER_LINUX
>
> Modified: compiler-rt/trunk/lib/lsan/lsan_interceptors.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_interceptors.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/lsan/lsan_interceptors.cc (original)
> +++ compiler-rt/trunk/lib/lsan/lsan_interceptors.cc Wed Sep 30 19:22:21
> 2015
> @@ -71,7 +71,7 @@ INTERCEPTOR(void*, calloc, uptr nmemb, u
>      CHECK(allocated < kCallocPoolSize);
>      return mem;
>    }
> -  if (CallocShouldReturnNullDueToOverflow(size, nmemb)) return 0;
> +  if (CallocShouldReturnNullDueToOverflow(size, nmemb)) return nullptr;
>    ENSURE_LSAN_INITED;
>    GET_STACK_TRACE_MALLOC;
>    size *= nmemb;
> @@ -226,7 +226,7 @@ INTERCEPTOR(int, pthread_create, void *t
>    ENSURE_LSAN_INITED;
>    EnsureMainThreadIDIsCorrect();
>    __sanitizer_pthread_attr_t myattr;
> -  if (attr == 0) {
> +  if (!attr) {
>      pthread_attr_init(&myattr);
>      attr = &myattr;
>    }
> @@ -284,4 +284,4 @@ void InitializeInterceptors() {
>    }
>  }
>
> -}  // namespace __lsan
> +} // namespace __lsan
>
> Modified: compiler-rt/trunk/lib/lsan/lsan_thread.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_thread.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/lsan/lsan_thread.cc (original)
> +++ compiler-rt/trunk/lib/lsan/lsan_thread.cc Wed Sep 30 19:22:21 2015
> @@ -79,7 +79,7 @@ void ThreadContext::OnFinished() {
>
>  u32 ThreadCreate(u32 parent_tid, uptr user_id, bool detached) {
>    return thread_registry->CreateThread(user_id, detached, parent_tid,
> -                                       /* arg */ 0);
> +                                       /* arg */ nullptr);
>  }
>
>  void ThreadStart(u32 tid, uptr os_id) {
> @@ -99,9 +99,9 @@ void ThreadFinish() {
>  }
>
>  ThreadContext *CurrentThreadContext() {
> -  if (!thread_registry) return 0;
> +  if (!thread_registry) return nullptr;
>    if (GetCurrentThread() == kInvalidTid)
> -    return 0;
> +    return nullptr;
>    // No lock needed when getting current thread.
>    return (ThreadContext
> *)thread_registry->GetThreadLocked(GetCurrentThread());
>  }
> @@ -120,7 +120,7 @@ u32 ThreadTid(uptr uid) {
>
>  void ThreadJoin(u32 tid) {
>    CHECK_NE(tid, kInvalidTid);
> -  thread_registry->JoinThread(tid, /* arg */0);
> +  thread_registry->JoinThread(tid, /* arg */nullptr);
>  }
>
>  void EnsureMainThreadIDIsCorrect() {
> @@ -157,4 +157,4 @@ void UnlockThreadRegistry() {
>    thread_registry->Unlock();
>  }
>
> -}  // namespace __lsan
> +} // namespace __lsan
>
> Modified: compiler-rt/trunk/lib/msan/msan.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/msan/msan.cc (original)
> +++ compiler-rt/trunk/lib/msan/msan.cc Wed Sep 30 19:22:21 2015
> @@ -223,9 +223,9 @@ void GetStackTrace(BufferedStackTrace *s
>    if (!t || !StackTrace::WillUseFastUnwind(request_fast_unwind)) {
>      // Block reports from our interceptors during _Unwind_Backtrace.
>      SymbolizerScope sym_scope;
> -    return stack->Unwind(max_s, pc, bp, 0, 0, 0, request_fast_unwind);
> +    return stack->Unwind(max_s, pc, bp, nullptr, 0, 0,
> request_fast_unwind);
>    }
> -  stack->Unwind(max_s, pc, bp, 0, t->stack_top(), t->stack_bottom(),
> +  stack->Unwind(max_s, pc, bp, nullptr, t->stack_top(), t->stack_bottom(),
>                  request_fast_unwind);
>  }
>
> @@ -305,7 +305,7 @@ u32 ChainOrigin(u32 id, StackTrace *stac
>    return chained.raw_id();
>  }
>
> -}  // namespace __msan
> +} // namespace __msan
>
>  // Interface.
>
> @@ -417,7 +417,7 @@ void __msan_init() {
>
>    MsanAllocatorInit();
>
> -  MsanThread *main_thread = MsanThread::Create(0, 0);
> +  MsanThread *main_thread = MsanThread::Create(nullptr, nullptr);
>    SetCurrentThread(main_thread);
>    main_thread->ThreadStart();
>
> @@ -641,4 +641,4 @@ void __sanitizer_print_stack_trace() {
>    GET_FATAL_STACK_TRACE_PC_BP(StackTrace::GetCurrentPc(),
> GET_CURRENT_FRAME());
>    stack.Print();
>  }
> -}  // extern "C"
> +} // extern "C"
>
> Modified: compiler-rt/trunk/lib/msan/msan_allocator.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_allocator.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/msan/msan_allocator.cc (original)
> +++ compiler-rt/trunk/lib/msan/msan_allocator.cc Wed Sep 30 19:22:21 2015
> @@ -165,7 +165,7 @@ void MsanDeallocate(StackTrace *stack, v
>  void *MsanCalloc(StackTrace *stack, uptr nmemb, uptr size) {
>    if (CallocShouldReturnNullDueToOverflow(size, nmemb))
>      return allocator.ReturnNullOrDie();
> -  return MsanReallocate(stack, 0, nmemb * size, sizeof(u64), true);
> +  return MsanReallocate(stack, nullptr, nmemb * size, sizeof(u64), true);
>  }
>
>  void *MsanReallocate(StackTrace *stack, void *old_p, uptr new_size,
> @@ -174,7 +174,7 @@ void *MsanReallocate(StackTrace *stack,
>      return MsanAllocate(stack, new_size, alignment, zeroise);
>    if (!new_size) {
>      MsanDeallocate(stack, old_p);
> -    return 0;
> +    return nullptr;
>    }
>    Metadata *meta =
> reinterpret_cast<Metadata*>(allocator.GetMetaData(old_p));
>    uptr old_size = meta->requested_size;
> @@ -204,14 +204,14 @@ void *MsanReallocate(StackTrace *stack,
>  }
>
>  static uptr AllocationSize(const void *p) {
> -  if (p == 0) return 0;
> +  if (!p) return 0;
>    const void *beg = allocator.GetBlockBegin(p);
>    if (beg != p) return 0;
>    Metadata *b = (Metadata *)allocator.GetMetaData(p);
>    return b->requested_size;
>  }
>
> -}  // namespace __msan
> +} // namespace __msan
>
>  using namespace __msan;
>
>
> Modified: compiler-rt/trunk/lib/msan/msan_chained_origin_depot.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_chained_origin_depot.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/msan/msan_chained_origin_depot.cc (original)
> +++ compiler-rt/trunk/lib/msan/msan_chained_origin_depot.cc Wed Sep 30
> 19:22:21 2015
> @@ -28,12 +28,15 @@ struct ChainedOriginDepotNode {
>    u32 prev_id;
>
>    typedef ChainedOriginDepotDesc args_type;
> +
>    bool eq(u32 hash, const args_type &args) const {
>      return here_id == args.here_id && prev_id == args.prev_id;
>    }
> +
>    static uptr storage_size(const args_type &args) {
>      return sizeof(ChainedOriginDepotNode);
>    }
> +
>    /* This is murmur2 hash for the 64->32 bit case.
>       It does not behave all that well because the keys have a very biased
>       distribution (I've seen 7-element buckets with the table only 14%
> full).
> @@ -76,19 +79,22 @@ struct ChainedOriginDepotNode {
>      here_id = args.here_id;
>      prev_id = args.prev_id;
>    }
> +
>    args_type load() const {
>      args_type ret = {here_id, prev_id};
>      return ret;
>    }
> +
>    struct Handle {
>      ChainedOriginDepotNode *node_;
> -    Handle() : node_(0) {}
> +    Handle() : node_(nullptr) {}
>      explicit Handle(ChainedOriginDepotNode *node) : node_(node) {}
>      bool valid() { return node_; }
>      u32 id() { return node_->id; }
>      int here_id() { return node_->here_id; }
>      int prev_id() { return node_->prev_id; }
>    };
> +
>    Handle get_handle() { return Handle(this); }
>
>    typedef Handle handle_type;
> @@ -123,4 +129,4 @@ void ChainedOriginDepotUnlockAll() {
>    chainedOriginDepot.UnlockAll();
>  }
>
> -}  // namespace __msan
> +} // namespace __msan
>
> Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
> +++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Wed Sep 30 19:22:21
> 2015
> @@ -166,7 +166,7 @@ INTERCEPTOR(int, posix_memalign, void **
>    GET_MALLOC_STACK_TRACE;
>    CHECK_EQ(alignment & (alignment - 1), 0);
>    CHECK_NE(memptr, 0);
> -  *memptr = MsanReallocate(&stack, 0, size, alignment, false);
> +  *memptr = MsanReallocate(&stack, nullptr, size, alignment, false);
>    CHECK_NE(*memptr, 0);
>    __msan_unpoison(memptr, sizeof(*memptr));
>    return 0;
> @@ -176,7 +176,7 @@ INTERCEPTOR(int, posix_memalign, void **
>  INTERCEPTOR(void *, memalign, SIZE_T boundary, SIZE_T size) {
>    GET_MALLOC_STACK_TRACE;
>    CHECK_EQ(boundary & (boundary - 1), 0);
> -  void *ptr = MsanReallocate(&stack, 0, size, boundary, false);
> +  void *ptr = MsanReallocate(&stack, nullptr, size, boundary, false);
>    return ptr;
>  }
>  #define MSAN_MAYBE_INTERCEPT_MEMALIGN INTERCEPT_FUNCTION(memalign)
> @@ -187,21 +187,21 @@ INTERCEPTOR(void *, memalign, SIZE_T bou
>  INTERCEPTOR(void *, aligned_alloc, SIZE_T boundary, SIZE_T size) {
>    GET_MALLOC_STACK_TRACE;
>    CHECK_EQ(boundary & (boundary - 1), 0);
> -  void *ptr = MsanReallocate(&stack, 0, size, boundary, false);
> +  void *ptr = MsanReallocate(&stack, nullptr, size, boundary, false);
>    return ptr;
>  }
>
>  INTERCEPTOR(void *, __libc_memalign, SIZE_T boundary, SIZE_T size) {
>    GET_MALLOC_STACK_TRACE;
>    CHECK_EQ(boundary & (boundary - 1), 0);
> -  void *ptr = MsanReallocate(&stack, 0, size, boundary, false);
> +  void *ptr = MsanReallocate(&stack, nullptr, size, boundary, false);
>    DTLS_on_libc_memalign(ptr, size * boundary);
>    return ptr;
>  }
>
>  INTERCEPTOR(void *, valloc, SIZE_T size) {
>    GET_MALLOC_STACK_TRACE;
> -  void *ptr = MsanReallocate(&stack, 0, size, GetPageSizeCached(), false);
> +  void *ptr = MsanReallocate(&stack, nullptr, size, GetPageSizeCached(),
> false);
>    return ptr;
>  }
>
> @@ -214,7 +214,7 @@ INTERCEPTOR(void *, pvalloc, SIZE_T size
>      // pvalloc(0) should allocate one page.
>      size = PageSize;
>    }
> -  void *ptr = MsanReallocate(&stack, 0, size, PageSize, false);
> +  void *ptr = MsanReallocate(&stack, nullptr, size, PageSize, false);
>    return ptr;
>  }
>  #define MSAN_MAYBE_INTERCEPT_PVALLOC INTERCEPT_FUNCTION(pvalloc)
> @@ -224,14 +224,14 @@ INTERCEPTOR(void *, pvalloc, SIZE_T size
>
>  INTERCEPTOR(void, free, void *ptr) {
>    GET_MALLOC_STACK_TRACE;
> -  if (ptr == 0) return;
> +  if (!ptr) return;
>    MsanDeallocate(&stack, ptr);
>  }
>
>  #if !SANITIZER_FREEBSD
>  INTERCEPTOR(void, cfree, void *ptr) {
>    GET_MALLOC_STACK_TRACE;
> -  if (ptr == 0) return;
> +  if (!ptr) return;
>    MsanDeallocate(&stack, ptr);
>  }
>  #define MSAN_MAYBE_INTERCEPT_CFREE INTERCEPT_FUNCTION(cfree)
> @@ -1000,7 +1000,7 @@ INTERCEPTOR(void *, realloc, void *ptr,
>
>  INTERCEPTOR(void *, malloc, SIZE_T size) {
>    GET_MALLOC_STACK_TRACE;
> -  return MsanReallocate(&stack, 0, size, sizeof(u64), false);
> +  return MsanReallocate(&stack, nullptr, size, sizeof(u64), false);
>  }
>
>  void __msan_allocated_memory(const void *data, uptr size) {
> @@ -1029,7 +1029,7 @@ INTERCEPTOR(void *, mmap, void *addr, SI
>        *__errno_location() = errno_EINVAL;
>        return (void *)-1;
>      } else {
> -      addr = 0;
> +      addr = nullptr;
>      }
>    }
>    void *res = REAL(mmap)(addr, length, prot, flags, fd, offset);
> @@ -1047,7 +1047,7 @@ INTERCEPTOR(void *, mmap64, void *addr,
>        *__errno_location() = errno_EINVAL;
>        return (void *)-1;
>      } else {
> -      addr = 0;
> +      addr = nullptr;
>      }
>    }
>    void *res = REAL(mmap64)(addr, length, prot, flags, fd, offset);
> @@ -1083,7 +1083,7 @@ INTERCEPTOR(int, dladdr, void *addr, dli
>  INTERCEPTOR(char *, dlerror, int fake) {
>    ENSURE_MSAN_INITED();
>    char *res = REAL(dlerror)(fake);
> -  if (res != 0) __msan_unpoison(res, REAL(strlen)(res) + 1);
> +  if (res) __msan_unpoison(res, REAL(strlen)(res) + 1);
>    return res;
>  }
>
> @@ -1180,7 +1180,7 @@ INTERCEPTOR(int, sigaction, int signo, c
>      CHECK_LT(signo, kMaxSignals);
>      uptr old_cb = atomic_load(&sigactions[signo], memory_order_relaxed);
>      __sanitizer_sigaction new_act;
> -    __sanitizer_sigaction *pnew_act = act ? &new_act : 0;
> +    __sanitizer_sigaction *pnew_act = act ? &new_act : nullptr;
>      if (act) {
>        REAL(memcpy)(pnew_act, act, sizeof(__sanitizer_sigaction));
>        uptr cb = (uptr)pnew_act->sigaction;
> @@ -1237,7 +1237,7 @@ INTERCEPTOR(int, pthread_create, void *t
>              void * param) {
>    ENSURE_MSAN_INITED(); // for GetTlsSize()
>    __sanitizer_pthread_attr_t myattr;
> -  if (attr == 0) {
> +  if (!attr) {
>      pthread_attr_init(&myattr);
>      attr = &myattr;
>    }
> @@ -1376,7 +1376,7 @@ int OnExit() {
>    return 0;
>  }
>
> -}  // namespace __msan
> +} // namespace __msan
>
>  // A version of CHECK_UNPOISONED using a saved scope value. Used in common
>  // interceptors.
> @@ -1634,4 +1634,4 @@ void InitializeInterceptors() {
>
>    inited = 1;
>  }
> -}  // namespace __msan
> +} // namespace __msan
>
> Modified: compiler-rt/trunk/lib/msan/msan_linux.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_linux.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/msan/msan_linux.cc (original)
> +++ compiler-rt/trunk/lib/msan/msan_linux.cc Wed Sep 30 19:22:21 2015
> @@ -56,7 +56,7 @@ static bool CheckMemoryRangeAvailability
>  static bool ProtectMemoryRange(uptr beg, uptr size, const char *name) {
>    if (size > 0) {
>      void *addr = MmapNoAccess(beg, size, name);
> -    if (beg == 0 && addr != 0) {
> +    if (beg == 0 && addr) {
>        // Depending on the kernel configuration, we may not be able to
> protect
>        // the page at address zero.
>        uptr gap = 16 * GetPageSizeCached();
> @@ -204,6 +204,6 @@ void MsanTSDDtor(void *tsd) {
>    MsanThread::TSDDtor(tsd);
>  }
>
> -}  // namespace __msan
> +} // namespace __msan
>
> -#endif  // SANITIZER_FREEBSD || SANITIZER_LINUX
> +#endif // SANITIZER_FREEBSD || SANITIZER_LINUX
>
> Modified: compiler-rt/trunk/lib/msan/msan_thread.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_thread.h?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/msan/msan_thread.h (original)
> +++ compiler-rt/trunk/lib/msan/msan_thread.h Wed Sep 30 19:22:21 2015
> @@ -32,7 +32,7 @@ class MsanThread {
>    uptr stack_bottom() { return stack_bottom_; }
>    uptr tls_begin() { return tls_begin_; }
>    uptr tls_end() { return tls_end_; }
> -  bool IsMainThread() { return start_routine_ == 0; }
> +  bool IsMainThread() { return start_routine_ == nullptr; }
>
>    bool AddrIsInStack(uptr addr) {
>      return addr >= stack_bottom_ && addr < stack_top_;
>
> Modified: compiler-rt/trunk/lib/safestack/safestack.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/safestack/safestack.cc?rev=248966&r1=248965&r2=248966&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/safestack/safestack.cc (original)
> +++ compiler-rt/trunk/lib/safestack/safestack.cc Wed Sep 30 19:22:21 2015
> @@ -171,7 +171,7 @@ INTERCEPTOR(int, pthread_create, pthread
>    size_t size = 0;
>    size_t guard = 0;
>
> -  if (attr != NULL) {
> +  if (attr) {
>      pthread_attr_getstacksize(attr, &size);
>      pthread_attr_getguardsize(attr, &guard);
>    } else {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150930/98d0fbc0/attachment-0001.html>


More information about the llvm-commits mailing list