Index: llvm/include/llvm/Demangle/ItaniumDemangle.h =================================================================== --- llvm/include/llvm/Demangle/ItaniumDemangle.h +++ llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -19,6 +19,7 @@ #include "DemangleConfig.h" #include "StringView.h" #include "Utility.h" +#include "llvm/Support/Threading.h" #include #include #include @@ -3029,12 +3030,11 @@ #ifndef NDEBUG { // Verify table order. - static bool Done; - if (!Done) { - Done = true; + static llvm::once_flag Done; + llvm::call_once(Done, []() { for (const auto *Op = &Ops[0]; Op != &Ops[NumOps - 1]; Op++) assert(Op[0] < Op[1] && "Operator table is not ordered"); - } + }); } #endif