summaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm16/lib/Support/BuryPointer.cpp
diff options
context:
space:
mode:
authorvitalyisaev <[email protected]>2023-06-29 10:00:50 +0300
committervitalyisaev <[email protected]>2023-06-29 10:00:50 +0300
commit6ffe9e53658409f212834330e13564e4952558f6 (patch)
tree85b1e00183517648b228aafa7c8fb07f5276f419 /contrib/libs/llvm16/lib/Support/BuryPointer.cpp
parent726057070f9c5a91fc10fde0d5024913d10f1ab9 (diff)
YQ Connector: support managed ClickHouse
Со стороны dqrun можно обратиться к инстансу коннектора, который работает на streaming стенде, и извлечь данные из облачного CH.
Diffstat (limited to 'contrib/libs/llvm16/lib/Support/BuryPointer.cpp')
-rw-r--r--contrib/libs/llvm16/lib/Support/BuryPointer.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/libs/llvm16/lib/Support/BuryPointer.cpp b/contrib/libs/llvm16/lib/Support/BuryPointer.cpp
new file mode 100644
index 00000000000..87d2406bbfd
--- /dev/null
+++ b/contrib/libs/llvm16/lib/Support/BuryPointer.cpp
@@ -0,0 +1,30 @@
+//===- BuryPointer.cpp - Memory Manipulation/Leak ---------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/BuryPointer.h"
+#include "llvm/Support/Compiler.h"
+#include <atomic>
+
+namespace llvm {
+
+void BuryPointer(const void *Ptr) {
+ // This function may be called only a small fixed amount of times per each
+ // invocation, otherwise we do actually have a leak which we want to report.
+ // If this function is called more than kGraveYardMaxSize times, the pointers
+ // will not be properly buried and a leak detector will report a leak, which
+ // is what we want in such case.
+ static const size_t kGraveYardMaxSize = 16;
+ LLVM_ATTRIBUTE_USED static const void *GraveYard[kGraveYardMaxSize];
+ static std::atomic<unsigned> GraveYardSize;
+ unsigned Idx = GraveYardSize++;
+ if (Idx >= kGraveYardMaxSize)
+ return;
+ GraveYard[Idx] = Ptr;
+}
+
+} // namespace llvm