Fix includes and fuse constructors of SpinLock.

PiperOrigin-RevId: 774835829
Change-Id: I0fa7cab1b98c1b7222de0acd71b7846df693f1e2
diff --git a/absl/base/internal/spinlock.cc b/absl/base/internal/spinlock.cc
index 430f775..4168b8b 100644
--- a/absl/base/internal/spinlock.cc
+++ b/absl/base/internal/spinlock.cc
@@ -16,15 +16,18 @@
 
 #include <algorithm>
 #include <atomic>
+#include <cstdint>
 #include <limits>
 
 #include "absl/base/attributes.h"
+#include "absl/base/call_once.h"
 #include "absl/base/config.h"
 #include "absl/base/internal/atomic_hook.h"
 #include "absl/base/internal/cycleclock.h"
+#include "absl/base/internal/scheduling_mode.h"
 #include "absl/base/internal/spinlock_wait.h"
 #include "absl/base/internal/sysinfo.h" /* For NumCPUs() */
-#include "absl/base/call_once.h"
+#include "absl/base/internal/tsan_mutex_interface.h"
 
 // Description of lock-word:
 //  31..00: [............................3][2][1][0]
@@ -58,7 +61,7 @@
 ABSL_NAMESPACE_BEGIN
 namespace base_internal {
 
-ABSL_INTERNAL_ATOMIC_HOOK_ATTRIBUTES static base_internal::AtomicHook<void (*)(
+ABSL_INTERNAL_ATOMIC_HOOK_ATTRIBUTES static AtomicHook<void (*)(
     const void *lock, int64_t wait_cycles)>
     submit_profile_data;
 
@@ -67,12 +70,6 @@
   submit_profile_data.Store(fn);
 }
 
-// Uncommon constructors.
-SpinLock::SpinLock(base_internal::SchedulingMode mode)
-    : lockword_(IsCooperative(mode) ? kSpinLockCooperative : 0) {
-  ABSL_TSAN_MUTEX_CREATE(this, __tsan_mutex_not_static);
-}
-
 // Monitor the lock to see if its value changes within some time period
 // (adaptive_spin_count loop iterations). The last value read from the lock
 // is returned from the method.
@@ -81,9 +78,8 @@
   // adaptive_spin_count here.
   ABSL_CONST_INIT static absl::once_flag init_adaptive_spin_count;
   ABSL_CONST_INIT static int adaptive_spin_count = 0;
-  base_internal::LowLevelCallOnce(&init_adaptive_spin_count, []() {
-    adaptive_spin_count = base_internal::NumCPUs() > 1 ? 1000 : 1;
-  });
+  LowLevelCallOnce(&init_adaptive_spin_count,
+                   []() { adaptive_spin_count = NumCPUs() > 1 ? 1000 : 1; });
 
   int c = adaptive_spin_count;
   uint32_t lock_value;
@@ -100,11 +96,11 @@
     return;
   }
 
-  base_internal::SchedulingMode scheduling_mode;
+  SchedulingMode scheduling_mode;
   if ((lock_value & kSpinLockCooperative) != 0) {
-    scheduling_mode = base_internal::SCHEDULE_COOPERATIVE_AND_KERNEL;
+    scheduling_mode = SCHEDULE_COOPERATIVE_AND_KERNEL;
   } else {
-    scheduling_mode = base_internal::SCHEDULE_KERNEL_ONLY;
+    scheduling_mode = SCHEDULE_KERNEL_ONLY;
   }
 
   // The lock was not obtained initially, so this thread needs to wait for
@@ -134,7 +130,7 @@
         // new lock state will be the number of cycles this thread waited if
         // this thread obtains the lock.
         lock_value = TryLockInternal(lock_value, wait_cycles);
-        continue;   // Skip the delay at the end of the loop.
+        continue;  // Skip the delay at the end of the loop.
       } else if ((lock_value & kWaitTimeMask) == 0) {
         // The lock is still held, without a waiter being marked, but something
         // else about the lock word changed, causing our CAS to fail. For
@@ -150,8 +146,8 @@
     // synchronization there to avoid false positives.
     ABSL_TSAN_MUTEX_PRE_DIVERT(this, 0);
     // Wait for an OS specific delay.
-    base_internal::SpinLockDelay(&lockword_, lock_value, ++lock_wait_call_count,
-                                 scheduling_mode);
+    SpinLockDelay(&lockword_, lock_value, ++lock_wait_call_count,
+                  scheduling_mode);
     ABSL_TSAN_MUTEX_POST_DIVERT(this, 0);
     // Spin again after returning from the wait routine to give this thread
     // some chance of obtaining the lock.
@@ -162,8 +158,8 @@
 }
 
 void SpinLock::SlowUnlock(uint32_t lock_value) {
-  base_internal::SpinLockWake(&lockword_,
-                              false);  // wake waiter if necessary
+  SpinLockWake(&lockword_,
+               false);  // wake waiter if necessary
 
   // If our acquisition was contended, collect contentionz profile info.  We
   // reserve a unitary wait time to represent that a waiter exists without our
diff --git a/absl/base/internal/spinlock.h b/absl/base/internal/spinlock.h
index 2a10896..022dcf2 100644
--- a/absl/base/internal/spinlock.h
+++ b/absl/base/internal/spinlock.h
@@ -19,7 +19,7 @@
 //   - for use by Abseil internal code that Mutex itself depends on
 //   - for async signal safety (see below)
 
-// SpinLock with a base_internal::SchedulingMode::SCHEDULE_KERNEL_ONLY is async
+// SpinLock with a SchedulingMode::SCHEDULE_KERNEL_ONLY is async
 // signal safe. If a spinlock is used within a signal handler, all code that
 // acquires the lock must ensure that the signal cannot arrive while they are
 // holding the lock. Typically, this is done by blocking the signal.
@@ -31,14 +31,16 @@
 
 #include <atomic>
 #include <cstdint>
+#include <type_traits>
 
 #include "absl/base/attributes.h"
+#include "absl/base/config.h"
 #include "absl/base/const_init.h"
-#include "absl/base/dynamic_annotations.h"
 #include "absl/base/internal/low_level_scheduling.h"
 #include "absl/base/internal/raw_logging.h"
 #include "absl/base/internal/scheduling_mode.h"
 #include "absl/base/internal/tsan_mutex_interface.h"
+#include "absl/base/macros.h"
 #include "absl/base/thread_annotations.h"
 
 namespace tcmalloc {
@@ -55,17 +57,31 @@
 
 class ABSL_LOCKABLE ABSL_ATTRIBUTE_WARN_UNUSED SpinLock {
  public:
-  SpinLock() : lockword_(kSpinLockCooperative) {
-    ABSL_TSAN_MUTEX_CREATE(this, __tsan_mutex_not_static);
-  }
+  constexpr SpinLock() : lockword_(kSpinLockCooperative) { RegisterWithTsan(); }
 
   // Constructors that allow non-cooperative spinlocks to be created for use
   // inside thread schedulers.  Normal clients should not use these.
-  explicit SpinLock(base_internal::SchedulingMode mode);
+  constexpr explicit SpinLock(SchedulingMode mode)
+      : lockword_(IsCooperative(mode) ? kSpinLockCooperative : 0) {
+    RegisterWithTsan();
+  }
+
+#if ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(_WIN32)
+  // Constructor to inline users of the default scheduling mode.
+  //
+  // This only needs to exists for inliner runs, but doesn't work correctly in
+  // clang+windows builds, likely due to mangling differences.
+  ABSL_DEPRECATE_AND_INLINE()
+  constexpr explicit SpinLock(SchedulingMode mode)
+      __attribute__((enable_if(mode == SCHEDULE_COOPERATIVE_AND_KERNEL,
+                               "Cooperative use default constructor")))
+      : SpinLock() {}
+#endif
 
   // Constructor for global SpinLock instances.  See absl/base/const_init.h.
-  constexpr SpinLock(absl::ConstInitType, base_internal::SchedulingMode mode)
-      : lockword_(IsCooperative(mode) ? kSpinLockCooperative : 0) {}
+  ABSL_DEPRECATE_AND_INLINE()
+  constexpr SpinLock(absl::ConstInitType, SchedulingMode mode)
+      : SpinLock(mode) {}
 
   // For global SpinLock instances prefer trivial destructor when possible.
   // Default but non-trivial destructor in some build configurations causes an
@@ -106,7 +122,7 @@
                                     std::memory_order_release);
 
     if ((lock_value & kSpinLockDisabledScheduling) != 0) {
-      base_internal::SchedulingGuard::EnableRescheduling(true);
+      SchedulingGuard::EnableRescheduling(true);
     }
     if ((lock_value & kWaitTimeMask) != 0) {
       // Collect contentionz profile info, and speed the wakeup of any waiter.
@@ -175,9 +191,16 @@
       ~(kSpinLockHeld | kSpinLockCooperative | kSpinLockDisabledScheduling);
 
   // Returns true if the provided scheduling mode is cooperative.
-  static constexpr bool IsCooperative(
-      base_internal::SchedulingMode scheduling_mode) {
-    return scheduling_mode == base_internal::SCHEDULE_COOPERATIVE_AND_KERNEL;
+  static constexpr bool IsCooperative(SchedulingMode scheduling_mode) {
+    return scheduling_mode == SCHEDULE_COOPERATIVE_AND_KERNEL;
+  }
+
+  constexpr void RegisterWithTsan() {
+#if ABSL_HAVE_BUILTIN(__builtin_is_constant_evaluated)
+    if (!__builtin_is_constant_evaluated()) {
+      ABSL_TSAN_MUTEX_CREATE(this, __tsan_mutex_not_static);
+    }
+#endif
   }
 
   bool IsCooperative() const {
@@ -243,7 +266,7 @@
   if ((lock_value & kSpinLockCooperative) == 0) {
     // For non-cooperative locks we must make sure we mark ourselves as
     // non-reschedulable before we attempt to CompareAndSwap.
-    if (base_internal::SchedulingGuard::DisableRescheduling()) {
+    if (SchedulingGuard::DisableRescheduling()) {
       sched_disabled_bit = kSpinLockDisabledScheduling;
     }
   }
@@ -252,7 +275,7 @@
           lock_value,
           kSpinLockHeld | lock_value | wait_cycles | sched_disabled_bit,
           std::memory_order_acquire, std::memory_order_relaxed)) {
-    base_internal::SchedulingGuard::EnableRescheduling(sched_disabled_bit != 0);
+    SchedulingGuard::EnableRescheduling(sched_disabled_bit != 0);
   }
 
   return lock_value;
diff --git a/absl/base/internal/thread_identity_test.cc b/absl/base/internal/thread_identity_test.cc
index 5f17553..4052291 100644
--- a/absl/base/internal/thread_identity_test.cc
+++ b/absl/base/internal/thread_identity_test.cc
@@ -31,7 +31,7 @@
 namespace {
 
 ABSL_CONST_INIT static absl::base_internal::SpinLock map_lock(
-    absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY);
+    base_internal::SCHEDULE_KERNEL_ONLY);
 ABSL_CONST_INIT static int num_identities_reused ABSL_GUARDED_BY(map_lock);
 
 static const void* const kCheckNoIdentity = reinterpret_cast<void*>(1);
diff --git a/absl/base/spinlock_test_common.cc b/absl/base/spinlock_test_common.cc
index e904715..dd8b3cb 100644
--- a/absl/base/spinlock_test_common.cc
+++ b/absl/base/spinlock_test_common.cc
@@ -60,24 +60,41 @@
 static constexpr size_t kArrayLength = 10;
 static uint32_t values[kArrayLength];
 
-ABSL_CONST_INIT static SpinLock static_cooperative_spinlock(
-    absl::kConstInit, base_internal::SCHEDULE_COOPERATIVE_AND_KERNEL);
+ABSL_CONST_INIT static SpinLock static_cooperative_spinlock;
 ABSL_CONST_INIT static SpinLock static_noncooperative_spinlock(
-    absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY);
+    base_internal::SCHEDULE_KERNEL_ONLY);
 
 // Simple integer hash function based on the public domain lookup2 hash.
 // http://burtleburtle.net/bob/c/lookup2.c
 static uint32_t Hash32(uint32_t a, uint32_t c) {
   uint32_t b = 0x9e3779b9UL;  // The golden ratio; an arbitrary value.
-  a -= b; a -= c; a ^= (c >> 13);
-  b -= c; b -= a; b ^= (a << 8);
-  c -= a; c -= b; c ^= (b >> 13);
-  a -= b; a -= c; a ^= (c >> 12);
-  b -= c; b -= a; b ^= (a << 16);
-  c -= a; c -= b; c ^= (b >> 5);
-  a -= b; a -= c; a ^= (c >> 3);
-  b -= c; b -= a; b ^= (a << 10);
-  c -= a; c -= b; c ^= (b >> 15);
+  a -= b;
+  a -= c;
+  a ^= (c >> 13);
+  b -= c;
+  b -= a;
+  b ^= (a << 8);
+  c -= a;
+  c -= b;
+  c ^= (b >> 13);
+  a -= b;
+  a -= c;
+  a ^= (c >> 12);
+  b -= c;
+  b -= a;
+  b ^= (a << 16);
+  c -= a;
+  c -= b;
+  c ^= (b >> 5);
+  a -= b;
+  a -= c;
+  a ^= (c >> 3);
+  b -= c;
+  b -= a;
+  b ^= (a << 10);
+  c -= a;
+  c -= b;
+  c ^= (b >> 15);
   return c;
 }
 
@@ -134,7 +151,7 @@
   // We should be able to encode up to (1^kMaxCycleBits - 1) without clamping
   // but the lower kProfileTimestampShift will be dropped.
   const int kMaxCyclesShift =
-    32 - kLockwordReservedShift + kProfileTimestampShift;
+      32 - kLockwordReservedShift + kProfileTimestampShift;
   const int64_t kMaxCycles = (int64_t{1} << kMaxCyclesShift) - 1;
 
   // These bits should be zero after encoding.
@@ -171,22 +188,22 @@
             SpinLockTest::DecodeWaitCycles(~kLockwordReservedMask));
 
   // Check that we cannot produce kSpinLockSleeper during encoding.
-  int64_t sleeper_cycles =
-      kSpinLockSleeper << (kProfileTimestampShift - kLockwordReservedShift);
+  int64_t sleeper_cycles = kSpinLockSleeper
+                           << (kProfileTimestampShift - kLockwordReservedShift);
   uint32_t sleeper_value =
       SpinLockTest::EncodeWaitCycles(start_time, start_time + sleeper_cycles);
   EXPECT_NE(sleeper_value, kSpinLockSleeper);
 
   // Test clamping
   uint32_t max_value =
-    SpinLockTest::EncodeWaitCycles(start_time, start_time + kMaxCycles);
+      SpinLockTest::EncodeWaitCycles(start_time, start_time + kMaxCycles);
   int64_t max_value_decoded = SpinLockTest::DecodeWaitCycles(max_value);
   int64_t expected_max_value_decoded = kMaxCycles & ~kProfileTimestampMask;
   EXPECT_EQ(expected_max_value_decoded, max_value_decoded);
 
   const int64_t step = (1 << kProfileTimestampShift);
-  uint32_t after_max_value =
-    SpinLockTest::EncodeWaitCycles(start_time, start_time + kMaxCycles + step);
+  uint32_t after_max_value = SpinLockTest::EncodeWaitCycles(
+      start_time, start_time + kMaxCycles + step);
   int64_t after_max_value_decoded =
       SpinLockTest::DecodeWaitCycles(after_max_value);
   EXPECT_EQ(expected_max_value_decoded, after_max_value_decoded);
diff --git a/absl/debugging/symbolize_elf.inc b/absl/debugging/symbolize_elf.inc
index 9836c93..17baff4 100644
--- a/absl/debugging/symbolize_elf.inc
+++ b/absl/debugging/symbolize_elf.inc
@@ -171,18 +171,18 @@
 // is being modified (is busy), we skip all decorators, and possibly
 // loose some info. Sorry, that's the best we could do.
 ABSL_CONST_INIT absl::base_internal::SpinLock g_decorators_mu(
-    absl::kConstInit, absl::base_internal::SCHEDULE_KERNEL_ONLY);
+    absl::base_internal::SCHEDULE_KERNEL_ONLY);
 
 const int kMaxFileMappingHints = 8;
 int g_num_file_mapping_hints;
 FileMappingHint g_file_mapping_hints[kMaxFileMappingHints];
 // Protects g_file_mapping_hints.
 ABSL_CONST_INIT absl::base_internal::SpinLock g_file_mapping_mu(
-    absl::kConstInit, absl::base_internal::SCHEDULE_KERNEL_ONLY);
+    absl::base_internal::SCHEDULE_KERNEL_ONLY);
 
 // Async-signal-safe function to zero a buffer.
 // memset() is not guaranteed to be async-signal-safe.
-static void SafeMemZero(void* p, size_t size) {
+static void SafeMemZero(void *p, size_t size) {
   unsigned char *c = static_cast<unsigned char *>(p);
   while (size--) {
     *c++ = 0;
@@ -1469,14 +1469,15 @@
       constexpr int interesting = PF_X | PF_R;
 #endif
 
-      if (phdr.p_type != PT_LOAD
-          || (phdr.p_flags & interesting) != interesting) {
+      if (phdr.p_type != PT_LOAD ||
+          (phdr.p_flags & interesting) != interesting) {
         // Not a LOAD segment, not executable code, and not a function
         // descriptor.
         continue;
       }
       if (num_interesting_load_segments < obj->phdr.size()) {
-        memcpy(&obj->phdr[num_interesting_load_segments++], &phdr, sizeof(phdr));
+        memcpy(&obj->phdr[num_interesting_load_segments++], &phdr,
+               sizeof(phdr));
       } else {
         ABSL_RAW_LOG(
             WARNING, "%s: too many interesting LOAD segments: %zu >= %zu",
@@ -1525,7 +1526,8 @@
             ABSL_RAW_CHECK(p.p_type == PT_NULL, "unexpected p_type");
             break;
           }
-          if (pc < reinterpret_cast<void *>(start_addr + p.p_vaddr + p.p_memsz)) {
+          if (pc <
+              reinterpret_cast<void *>(start_addr + p.p_vaddr + p.p_memsz)) {
             phdr = &p;
             break;
           }
@@ -1671,8 +1673,8 @@
   return ret;
 }
 
-bool RegisterFileMappingHint(const void *start, const void *end, uint64_t offset,
-                             const char *filename) {
+bool RegisterFileMappingHint(const void *start, const void *end,
+                             uint64_t offset, const char *filename) {
   SAFE_ASSERT(start <= end);
   SAFE_ASSERT(filename != nullptr);
 
@@ -1765,7 +1767,8 @@
 }  // namespace absl
 
 extern "C" bool AbslInternalGetFileMappingHint(const void **start,
-                                               const void **end, uint64_t *offset,
+                                               const void **end,
+                                               uint64_t *offset,
                                                const char **filename) {
   return absl::debugging_internal::GetFileMappingHint(start, end, offset,
                                                       filename);
diff --git a/absl/log/internal/vlog_config.cc b/absl/log/internal/vlog_config.cc
index f7c61be..040038f 100644
--- a/absl/log/internal/vlog_config.cc
+++ b/absl/log/internal/vlog_config.cc
@@ -90,7 +90,7 @@
 // To avoid problems with the heap checker which calls into `VLOG`, `mutex` must
 // be a `SpinLock` that prevents fiber scheduling instead of a `Mutex`.
 ABSL_CONST_INIT absl::base_internal::SpinLock mutex(
-    absl::kConstInit, absl::base_internal::SCHEDULE_KERNEL_ONLY);
+    absl::base_internal::SCHEDULE_KERNEL_ONLY);
 
 // `GetUpdateSitesMutex()` serializes updates to all of the sites (i.e. those in
 // `site_list_head`) themselves.
diff --git a/absl/strings/internal/cordz_info.h b/absl/strings/internal/cordz_info.h
index 2dc9d16..0091fa2 100644
--- a/absl/strings/internal/cordz_info.h
+++ b/absl/strings/internal/cordz_info.h
@@ -191,9 +191,7 @@
   // Global cordz info list. CordzInfo stores a pointer to the global list
   // instance to harden against ODR violations.
   struct List {
-    constexpr explicit List(absl::ConstInitType)
-        : mutex(absl::kConstInit,
-                absl::base_internal::SCHEDULE_COOPERATIVE_AND_KERNEL) {}
+    constexpr explicit List(absl::ConstInitType) {}
 
     SpinLock mutex;
     std::atomic<CordzInfo*> head ABSL_GUARDED_BY(mutex){nullptr};
diff --git a/absl/synchronization/internal/create_thread_identity.cc b/absl/synchronization/internal/create_thread_identity.cc
index 93cd376..2ec8075 100644
--- a/absl/synchronization/internal/create_thread_identity.cc
+++ b/absl/synchronization/internal/create_thread_identity.cc
@@ -35,7 +35,7 @@
 // ThreadIdentity storage is persistent, we maintain a free-list of previously
 // released ThreadIdentity objects.
 ABSL_CONST_INIT static base_internal::SpinLock freelist_lock(
-    absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY);
+    base_internal::SCHEDULE_KERNEL_ONLY);
 ABSL_CONST_INIT static base_internal::ThreadIdentity* thread_identity_freelist;
 
 // A per-thread destructor for reclaiming associated ThreadIdentity objects.
diff --git a/absl/synchronization/internal/graphcycles.cc b/absl/synchronization/internal/graphcycles.cc
index 129067c..914c81c 100644
--- a/absl/synchronization/internal/graphcycles.cc
+++ b/absl/synchronization/internal/graphcycles.cc
@@ -33,15 +33,15 @@
 #include "absl/base/internal/low_level_alloc.h"
 #ifndef ABSL_LOW_LEVEL_ALLOC_MISSING
 
-#include "absl/synchronization/internal/graphcycles.h"
-
 #include <algorithm>
 #include <array>
 #include <cinttypes>
 #include <limits>
+
 #include "absl/base/internal/hide_ptr.h"
 #include "absl/base/internal/raw_logging.h"
 #include "absl/base/internal/spinlock.h"
+#include "absl/synchronization/internal/graphcycles.h"
 
 // Do not use STL.   This module does not use standard memory allocation.
 
@@ -54,7 +54,7 @@
 // Avoid LowLevelAlloc's default arena since it calls malloc hooks in
 // which people are doing things like acquiring Mutexes.
 ABSL_CONST_INIT static absl::base_internal::SpinLock arena_mu(
-    absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY);
+    base_internal::SCHEDULE_KERNEL_ONLY);
 ABSL_CONST_INIT static base_internal::LowLevelAlloc::Arena* arena;
 
 static void InitArenaIfNecessary() {
@@ -89,7 +89,7 @@
   T* end() { return ptr_ + size_; }
   const T& operator[](uint32_t i) const { return ptr_[i]; }
   T& operator[](uint32_t i) { return ptr_[i]; }
-  const T& back() const { return ptr_[size_-1]; }
+  const T& back() const { return ptr_[size_ - 1]; }
   void pop_back() { size_--; }
 
   void push_back(const T& v) {
@@ -178,7 +178,7 @@
     }
     table_[i] = v;
     // Double when 75% full.
-    if (occupied_ >= table_.size() - table_.size()/4) Grow();
+    if (occupied_ >= table_.size() - table_.size() / 4) Grow();
     return true;
   }
 
@@ -193,7 +193,7 @@
   // Example:
   //    HASH_FOR_EACH(elem, node->out) { ... }
 #define HASH_FOR_EACH(elem, eset) \
-  for (int32_t elem, _cursor = 0; (eset).Next(&_cursor, &elem); )
+  for (int32_t elem, _cursor = 0; (eset).Next(&_cursor, &elem);)
   bool Next(int32_t* cursor, int32_t* elem) {
     while (static_cast<uint32_t>(*cursor) < table_.size()) {
       int32_t v = table_[static_cast<uint32_t>(*cursor)];
@@ -209,7 +209,7 @@
  private:
   enum : int32_t { kEmpty = -1, kDel = -2 };
   Vec<int32_t> table_;
-  uint32_t occupied_;     // Count of non-empty slots (includes deleted slots)
+  uint32_t occupied_;  // Count of non-empty slots (includes deleted slots)
 
   static uint32_t Hash(int32_t a) { return static_cast<uint32_t>(a) * 41; }
 
@@ -270,25 +270,23 @@
   return g;
 }
 
-inline int32_t NodeIndex(GraphId id) {
-  return static_cast<int32_t>(id.handle);
-}
+inline int32_t NodeIndex(GraphId id) { return static_cast<int32_t>(id.handle); }
 
 inline uint32_t NodeVersion(GraphId id) {
   return static_cast<uint32_t>(id.handle >> 32);
 }
 
 struct Node {
-  int32_t rank;               // rank number assigned by Pearce-Kelly algorithm
-  uint32_t version;           // Current version number
-  int32_t next_hash;          // Next entry in hash table
-  bool visited;               // Temporary marker used by depth-first-search
-  uintptr_t masked_ptr;       // User-supplied pointer
-  NodeSet in;                 // List of immediate predecessor nodes in graph
-  NodeSet out;                // List of immediate successor nodes in graph
-  int priority;               // Priority of recorded stack trace.
-  int nstack;                 // Depth of recorded stack trace.
-  void* stack[40];            // stack[0,nstack-1] holds stack trace for node.
+  int32_t rank;          // rank number assigned by Pearce-Kelly algorithm
+  uint32_t version;      // Current version number
+  int32_t next_hash;     // Next entry in hash table
+  bool visited;          // Temporary marker used by depth-first-search
+  uintptr_t masked_ptr;  // User-supplied pointer
+  NodeSet in;            // List of immediate predecessor nodes in graph
+  NodeSet out;           // List of immediate successor nodes in graph
+  int priority;          // Priority of recorded stack trace.
+  int nstack;            // Depth of recorded stack trace.
+  void* stack[40];       // stack[0,nstack-1] holds stack trace for node.
 };
 
 // Hash table for pointer to node index lookups.
@@ -318,7 +316,7 @@
     // Advance through linked list while keeping track of the
     // predecessor slot that points to the current entry.
     auto masked = base_internal::HidePtr(ptr);
-    for (int32_t* slot = &table_[Hash(ptr)]; *slot != -1; ) {
+    for (int32_t* slot = &table_[Hash(ptr)]; *slot != -1;) {
       int32_t index = *slot;
       Node* n = (*nodes_)[static_cast<uint32_t>(index)];
       if (n->masked_ptr == masked) {
@@ -381,7 +379,9 @@
 
 GraphCycles::~GraphCycles() {
   for (auto* node : rep_->nodes_) {
-    if (node == nullptr) { continue; }
+    if (node == nullptr) {
+      continue;
+    }
     node->Node::~Node();
     base_internal::LowLevelAlloc::Free(node);
   }
@@ -474,8 +474,7 @@
 
 void* GraphCycles::Ptr(GraphId id) {
   Node* n = FindNode(rep_, id);
-  return n == nullptr ? nullptr
-                      : base_internal::UnhidePtr<void>(n->masked_ptr);
+  return n == nullptr ? nullptr : base_internal::UnhidePtr<void>(n->masked_ptr);
 }
 
 bool GraphCycles::HasNode(GraphId node) {
@@ -502,8 +501,8 @@
 static void BackwardDFS(GraphCycles::Rep* r, int32_t n, int32_t lower_bound);
 static void Reorder(GraphCycles::Rep* r);
 static void Sort(const Vec<Node*>&, Vec<int32_t>* delta);
-static void MoveToList(
-    GraphCycles::Rep* r, Vec<int32_t>* src, Vec<int32_t>* dst);
+static void MoveToList(GraphCycles::Rep* r, Vec<int32_t>* src,
+                       Vec<int32_t>* dst);
 
 bool GraphCycles::InsertEdge(GraphId idx, GraphId idy) {
   Rep* r = rep_;
@@ -605,9 +604,8 @@
 
   // Produce sorted list of all ranks that will be reassigned.
   r->merged_.resize(r->deltab_.size() + r->deltaf_.size());
-  std::merge(r->deltab_.begin(), r->deltab_.end(),
-             r->deltaf_.begin(), r->deltaf_.end(),
-             r->merged_.begin());
+  std::merge(r->deltab_.begin(), r->deltab_.end(), r->deltaf_.begin(),
+             r->deltaf_.end(), r->merged_.begin());
 
   // Assign the ranks in order to the collected list.
   for (uint32_t i = 0; i < r->list_.size(); i++) {
@@ -628,8 +626,8 @@
   std::sort(delta->begin(), delta->end(), cmp);
 }
 
-static void MoveToList(
-    GraphCycles::Rep* r, Vec<int32_t>* src, Vec<int32_t>* dst) {
+static void MoveToList(GraphCycles::Rep* r, Vec<int32_t>* src,
+                       Vec<int32_t>* dst) {
   for (auto& v : *src) {
     int32_t w = v;
     // Replace v entry with its rank
diff --git a/absl/synchronization/mutex.cc b/absl/synchronization/mutex.cc
index 5091b8f..a4b0f01 100644
--- a/absl/synchronization/mutex.cc
+++ b/absl/synchronization/mutex.cc
@@ -226,7 +226,7 @@
 
 // Data for doing deadlock detection.
 ABSL_CONST_INIT static absl::base_internal::SpinLock deadlock_graph_mu(
-    absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY);
+    base_internal::SCHEDULE_KERNEL_ONLY);
 
 // Graph used to detect deadlocks.
 ABSL_CONST_INIT static GraphCycles* deadlock_graph
@@ -292,7 +292,7 @@
 };
 
 ABSL_CONST_INIT static absl::base_internal::SpinLock synch_event_mu(
-    absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY);
+    base_internal::SCHEDULE_KERNEL_ONLY);
 
 // Hash table size; should be prime > 2.
 // Can't be too small, as it's used for deadlock detection information.
@@ -509,10 +509,10 @@
   const Condition* cond;   // The condition that this thread is waiting for.
                            // In Mutex, this field is set to zero if a timeout
                            // expires.
-  KernelTimeout timeout;  // timeout expiry---absolute time
-                          // In Mutex, this field is set to zero if a timeout
-                          // expires.
-  Mutex* const cvmu;      // used for transfer from cond var to mutex
+  KernelTimeout timeout;   // timeout expiry---absolute time
+                           // In Mutex, this field is set to zero if a timeout
+                           // expires.
+  Mutex* const cvmu;       // used for transfer from cond var to mutex
   PerThreadSynch* const thread;  // thread that is waiting
 
   // If not null, thread should be enqueued on the CondVar whose state
@@ -1327,8 +1327,7 @@
   char sym[kSymLen];
   int len = 0;
   for (int i = 0; i != n; i++) {
-    if (len >= maxlen)
-      return buf;
+    if (len >= maxlen) return buf;
     size_t count = static_cast<size_t>(maxlen - len);
     if (symbolize) {
       if (!absl::Symbolize(pcs[i], sym, kSymLen)) {
@@ -2286,7 +2285,7 @@
         // set up to walk the list
         PerThreadSynch* w_walk;   // current waiter during list walk
         PerThreadSynch* pw_walk;  // previous waiter during list walk
-        if (old_h != nullptr) {  // we've searched up to old_h before
+        if (old_h != nullptr) {   // we've searched up to old_h before
           pw_walk = old_h;
           w_walk = old_h->next;
         } else {  // no prior search, start at beginning
diff --git a/absl/time/clock.cc b/absl/time/clock.cc
index ecd539e..7dd48f0 100644
--- a/absl/time/clock.cc
+++ b/absl/time/clock.cc
@@ -135,7 +135,7 @@
   // fetch_add would be before it, not after.
   std::atomic_thread_fence(std::memory_order_release);
 
-  return x + 2;   // original word plus 2
+  return x + 2;  // original word plus 2
 }
 
 // Release seqlock (*seq) by writing x to it---a value previously returned by
@@ -160,8 +160,8 @@
 // We require that kMinNSBetweenSamples shifted by kScale
 // have at least a bit left over for 64-bit calculations.
 static_assert(((kMinNSBetweenSamples << (kScale + 1)) >> (kScale + 1)) ==
-               kMinNSBetweenSamples,
-               "cannot represent kMaxBetweenSamplesNSScaled");
+                  kMinNSBetweenSamples,
+              "cannot represent kMaxBetweenSamplesNSScaled");
 
 // data from a sample of the kernel's time value
 struct TimeSampleAtomic {
@@ -206,8 +206,7 @@
 
   // A reader-writer lock protecting the static locations below.
   // See SeqAcquire() and SeqRelease() above.
-  absl::base_internal::SpinLock lock{absl::kConstInit,
-                                     base_internal::SCHEDULE_KERNEL_ONLY};
+  absl::base_internal::SpinLock lock{base_internal::SCHEDULE_KERNEL_ONLY};
 };
 ABSL_CONST_INIT static TimeState time_state;
 
@@ -439,8 +438,8 @@
   if (delta_cycles < sample.min_cycles_per_sample) {
     // Another thread updated the sample.  This path does not take the seqlock
     // so that blocked readers can make progress without blocking new readers.
-    estimated_base_ns = sample.base_ns +
-        ((delta_cycles * sample.nsscaled_per_cycle) >> kScale);
+    estimated_base_ns =
+        sample.base_ns + ((delta_cycles * sample.nsscaled_per_cycle) >> kScale);
     time_state.stats_fast_slow_paths++;
   } else {
     estimated_base_ns =
@@ -494,8 +493,8 @@
         estimated_scaled_ns = (delta_cycles >> s) * sample->nsscaled_per_cycle;
       } while (estimated_scaled_ns / sample->nsscaled_per_cycle !=
                (delta_cycles >> s));
-      estimated_base_ns = sample->base_ns +
-                          (estimated_scaled_ns >> (kScale - s));
+      estimated_base_ns =
+          sample->base_ns + (estimated_scaled_ns >> (kScale - s));
     }
 
     // Compute the assumed cycle time kMinNSBetweenSamples ns into the future
@@ -522,8 +521,8 @@
                                diff_ns - (diff_ns / 16));
     uint64_t new_nsscaled_per_cycle =
         SafeDivideAndScale(ns, assumed_next_sample_delta_cycles);
-    if (new_nsscaled_per_cycle != 0 &&
-        diff_ns < 100 * 1000 * 1000 && -diff_ns < 100 * 1000 * 1000) {
+    if (new_nsscaled_per_cycle != 0 && diff_ns < 100 * 1000 * 1000 &&
+        -diff_ns < 100 * 1000 * 1000) {
       // record the cycle time measurement
       time_state.last_sample.nsscaled_per_cycle.store(
           new_nsscaled_per_cycle, std::memory_order_relaxed);