[llvm] [Offload] Enable more refined debug printing (PR #163431)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 15 17:52:28 PDT 2025
================
@@ -75,17 +108,45 @@ inline std::atomic<uint32_t> &getInfoLevelInternal() {
inline uint32_t getInfoLevel() { return getInfoLevelInternal().load(); }
-inline uint32_t getDebugLevel() {
- static uint32_t DebugLevel = 0;
- static std::once_flag Flag{};
- std::call_once(Flag, []() {
- if (char *EnvStr = getenv("LIBOMPTARGET_DEBUG"))
- DebugLevel = std::stoi(EnvStr);
- });
-
- return DebugLevel;
+inline DebugOptionTy &getDebugOption() {
+ static DebugOptionTy DebugOption = []() {
+ DebugOptionTy OptVal{0, 0};
+ char *EnvStr = getenv("LIBOMPTARGET_DEBUG");
+ if (!EnvStr || *EnvStr == '0')
+ return OptVal; // undefined or explicitly defined as zero
+ OptVal.Level = std::atoi(EnvStr);
+ if (OptVal.Level)
+ return OptVal; // defined as numeric value
+ struct DebugStrToBitTy {
----------------
arsenm wrote:
static const
https://github.com/llvm/llvm-project/pull/163431
More information about the llvm-commits
mailing list