LLVM 22.0.0git
BuryPointer.h
Go to the documentation of this file.
1//===- llvm/Support/BuryPointer.h - Memory Manipulation/Leak ----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_SUPPORT_BURYPOINTER_H
10#define LLVM_SUPPORT_BURYPOINTER_H
11
13#include <memory>
14
15namespace llvm {
16
17// In tools that will exit soon anyway, going through the process of explicitly
18// deallocating resources can be unnecessary - better to leak the resources and
19// let the OS clean them up when the process ends. Use this function to ensure
20// the memory is not misdiagnosed as an unintentional leak by leak detection
21// tools (this is achieved by preserving pointers to the object in a globally
22// visible array).
23LLVM_ABI void BuryPointer(const void *Ptr);
24template <typename T> void BuryPointer(std::unique_ptr<T> Ptr) {
25 BuryPointer(Ptr.release());
26}
27
28} // namespace llvm
29
30#endif
#define LLVM_ABI
Definition Compiler.h:213
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void BuryPointer(const void *Ptr)