Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 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 <memory>
13
 
14
namespace llvm {
15
 
16
// In tools that will exit soon anyway, going through the process of explicitly
17
// deallocating resources can be unnecessary - better to leak the resources and
18
// let the OS clean them up when the process ends. Use this function to ensure
19
// the memory is not misdiagnosed as an unintentional leak by leak detection
20
// tools (this is achieved by preserving pointers to the object in a globally
21
// visible array).
22
void BuryPointer(const void *Ptr);
23
template <typename T> void BuryPointer(std::unique_ptr<T> Ptr) {
24
  BuryPointer(Ptr.release());
25
}
26
 
27
} // namespace llvm
28
 
29
#endif