[compiler-rt] d80a5d5 - [NFC][sanitizer] Move consts into on top of the class
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 12 13:59:37 PDT 2021
Author: Vitaly Buka
Date: 2021-10-12T13:59:16-07:00
New Revision: d80a5d54e1b7678b53b22f7762bb2ade415aefe2
URL: https://github.com/llvm/llvm-project/commit/d80a5d54e1b7678b53b22f7762bb2ade415aefe2
DIFF: https://github.com/llvm/llvm-project/commit/d80a5d54e1b7678b53b22f7762bb2ade415aefe2.diff
LOG: [NFC][sanitizer] Move consts into on top of the class
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
index 4d2c6c6a30a4..596bf76637f8 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
@@ -24,17 +24,18 @@ namespace __sanitizer {
template <class Node, int kReservedBits, int kTabSizeLog>
class StackDepotBase {
- static const u32 kIdSizeLog = sizeof(u32) * 8 - kReservedBits;
- static const u32 kNodesSize1Log = kIdSizeLog / 2;
- static const u32 kNodesSize2Log = kIdSizeLog - kNodesSize1Log;
+ static constexpr u32 kIdSizeLog = sizeof(u32) * 8 - kReservedBits;
+ static constexpr u32 kNodesSize1Log = kIdSizeLog / 2;
+ static constexpr u32 kNodesSize2Log = kIdSizeLog - kNodesSize1Log;
+ static constexpr int kTabSize = 1 << kTabSizeLog; // Hash table size.
public:
typedef typename Node::args_type args_type;
typedef typename Node::handle_type handle_type;
typedef typename Node::hash_type hash_type;
- static const u64 kNodesSize1 = 1ull << kNodesSize1Log;
- static const u64 kNodesSize2 = 1ull << kNodesSize2Log;
+ static constexpr u64 kNodesSize1 = 1ull << kNodesSize1Log;
+ static constexpr u64 kNodesSize2 = 1ull << kNodesSize2Log;
// Maps stack trace to an unique id.
handle_type Put(args_type args, bool *inserted = nullptr);
@@ -57,8 +58,6 @@ class StackDepotBase {
static Node *lock(atomic_uintptr_t *p);
static void unlock(atomic_uintptr_t *p, Node *s);
- static const int kTabSize = 1 << kTabSizeLog; // Hash table size.
-
atomic_uintptr_t tab[kTabSize]; // Hash table of Node's.
atomic_uint32_t n_uniq_ids;
More information about the llvm-commits
mailing list