#pragma once // // This file is distributed under the MIT License. See LICENSE.md for details. // #include #include template concept ErasableFromParent = requires(T *Pointer) { Pointer->eraseFromParent(); }; template void eraseLLVMValue(T *Pointer) { revng_assert(Pointer != nullptr); if (Pointer->getParent() != nullptr) { // TODO: extend eraseFromParent to dump users of llvm::Function and adopt it // there Pointer->eraseFromParent(); } else { delete Pointer; } } template using LLVMValueEraser = std::integral_constant), &eraseLLVMValue>; template using UniqueValuePtr = std::unique_ptr>;