1 //===- llvm/Support/BuryPointer.h - Memory Manipulation/Leak ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_SUPPORT_BURYPOINTER_H
11 #define LLVM_SUPPORT_BURYPOINTER_H
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
23 void BuryPointer(const void *Ptr);
24 template <typename T> void BuryPointer(std::unique_ptr<T> Ptr) {
25 BuryPointer(Ptr.release());