[Lldb-commits] [lldb] [lldb] Add Policy infrastructure (PR #195762)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue May 5 12:53:52 PDT 2026
================
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_THREADLOCALPOLICYSTACK_H
+#define LLDB_UTILITY_THREADLOCALPOLICYSTACK_H
+
+#include "llvm/ADT/SmallVector.h"
+
+namespace lldb_private {
+
+/// Generic per-thread policy stack.
+///
+/// The stack lives in thread_local storage. Each thread has its own stack,
+/// initialized with a default-constructed base entry that is never popped.
+/// RAII guards (Guard) push and pop policies.
+///
+/// For thread pool workers that don't inherit thread_local storage, the
+/// policy must be passed into the lambda and pushed onto the worker
+/// thread's stack when the task starts.
+template <typename Policy> class ThreadLocalPolicyStack {
----------------
JDevlieghere wrote:
I think this should just be PolicyStack. The thread localness is a property of how it's stored in `GetForCurrentThread`, not inherent to the data structure.
https://github.com/llvm/llvm-project/pull/195762
More information about the lldb-commits
mailing list