[compiler-rt] 3ec4d4d - [NFC][sanitizer] Add a few consts

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 12 15:38:50 PDT 2021


Author: Vitaly Buka
Date: 2021-10-12T15:38:37-07:00
New Revision: 3ec4d4dc999e62e5628a1b36fa6b22d24d34f0a3

URL: https://github.com/llvm/llvm-project/commit/3ec4d4dc999e62e5628a1b36fa6b22d24d34f0a3
DIFF: https://github.com/llvm/llvm-project/commit/3ec4d4dc999e62e5628a1b36fa6b22d24d34f0a3.diff

LOG: [NFC][sanitizer] Add a few consts

Depends on D111609.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D111610

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
    compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
index a0475220678f..c149e7aa2ff3 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 6f79fffeea8a..5ac9bbb7d88b 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();
 };
 


        


More information about the llvm-commits mailing list