From: Vitaly Buka Date: Tue, 12 Oct 2021 01:37:25 +0000 (-0700) Subject: [NFC][sanitizer] Add a few consts X-Git-Tag: upstream/15.0.7~28788 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ec4d4dc999e62e5628a1b36fa6b22d24d34f0a3;p=platform%2Fupstream%2Fllvm.git [NFC][sanitizer] Add a few consts Depends on D111609. Reviewed By: dvyukov Differential Revision: https://reviews.llvm.org/D111610 --- diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp index a047522..c149e7a 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp @@ -69,8 +69,8 @@ struct StackDepotNode { COMPILER_CHECK(StackDepotNode::kMaxUseCount >= (u32)kStackDepotMaxUseCount); -u32 StackDepotHandle::id() { return node_->id; } -int StackDepotHandle::use_count() { +u32 StackDepotHandle::id() const { return node_->id; } +int StackDepotHandle::use_count() const { return atomic_load(&node_->tag_and_use_count, memory_order_relaxed) & StackDepotNode::kUseCountMask; } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h index 6f79fff..5ac9bbb 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h @@ -25,9 +25,9 @@ struct StackDepotHandle { StackDepotNode *node_; StackDepotHandle() : node_(nullptr) {} explicit StackDepotHandle(StackDepotNode *node) : node_(node) {} - bool valid() { return node_; } - u32 id(); - int use_count(); + bool valid() const { return node_; } + u32 id() const; + int use_count() const; void inc_use_count_unsafe(); };