LLVM
22.0.0git
include
llvm
Support
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
12
#include "
llvm/Support/Compiler.h
"
13
#include <memory>
14
15
namespace
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).
23
LLVM_ABI
void
BuryPointer
(
const
void
*
Ptr
);
24
template
<
typename
T>
void
BuryPointer
(std::unique_ptr<T>
Ptr
) {
25
BuryPointer
(
Ptr
.release());
26
}
27
28
}
// namespace llvm
29
30
#endif
Compiler.h
LLVM_ABI
#define LLVM_ABI
Definition
Compiler.h:213
Ptr
@ Ptr
Definition
TargetLibraryInfo.cpp:77
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
AddressRanges.h:18
llvm::BuryPointer
LLVM_ABI void BuryPointer(const void *Ptr)
Definition
BuryPointer.cpp:15
Generated on
for LLVM by
1.14.0