/*========================== begin_copyright_notice ============================ Copyright (C) 2024 Intel Corporation SPDX-License-Identifier: MIT ============================= end_copyright_notice ===========================*/ /*========================== begin_copyright_notice ============================ Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information. SPDX-License-Identifier: Apache-2.0 with LLVM-exception ============================= end_copyright_notice ===========================*/ From 58f7b6504a97ece65ba015b7b11f34204cc73c0a Mon Sep 17 00:00:00 2001 From: Artem Gindinson Date: Tue, 6 Aug 2024 19:45:00 +0200 Subject: [PATCH] Revert "[LLVMContext] Remove hasSetOpaquePointersValue() API (NFC)" This reverts commit 4756f9ae0aa6c2a0b4231d93d5166c055f303603 by Nikita Popov : "[LLVMContext] Remove hasSetOpaquePointersValue() API (NFC) Now that we no longer perform any kind of typed pointer guessing, we no longer need this API". Signed-off-by: Artem Gindinson --- llvm/include/llvm/IR/LLVMContext.h | 3 +++ llvm/lib/IR/LLVMContext.cpp | 4 ++++ llvm/lib/IR/LLVMContextImpl.cpp | 4 ++++ llvm/lib/IR/LLVMContextImpl.h | 1 + 4 files changed, 12 insertions(+) diff --git a/llvm/include/llvm/IR/LLVMContext.h b/llvm/include/llvm/IR/LLVMContext.h index a8095a5c2fd3..c380ed215b6c 100644 --- a/llvm/include/llvm/IR/LLVMContext.h +++ b/llvm/include/llvm/IR/LLVMContext.h @@ -311,6 +311,9 @@ public: /// LLVMContext is used by compilation. void setOptPassGate(OptPassGate&); + /// Whether we've decided on using opaque pointers or typed pointers yet. + bool hasSetOpaquePointersValue() const; + /// Set whether opaque pointers are enabled. The method may be called multiple /// times, but only with the same value. Note that creating a pointer type or /// otherwise querying the opaque pointer mode performs an implicit set to diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index 7911705776e3..2b5577595ee3 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -368,6 +368,10 @@ std::unique_ptr LLVMContext::getDiagnosticHandler() { return std::move(pImpl->DiagHandler); } +bool LLVMContext::hasSetOpaquePointersValue() const { + return pImpl->hasOpaquePointersValue(); +} + void LLVMContext::setOpaquePointers(bool Enable) const { pImpl->setOpaquePointers(Enable); } diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp index 9acb1f654899..cd46a04a684b 100644 --- a/llvm/lib/IR/LLVMContextImpl.cpp +++ b/llvm/lib/IR/LLVMContextImpl.cpp @@ -249,6 +249,10 @@ void LLVMContextImpl::setOptPassGate(OptPassGate& OPG) { this->OPG = &OPG; } +bool LLVMContextImpl::hasOpaquePointersValue() { + return OpaquePointers.has_value(); +} + bool LLVMContextImpl::getOpaquePointers() { if (LLVM_UNLIKELY(!OpaquePointers)) OpaquePointers = OpaquePointersCL; diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index d2651a6ec72e..e5d9b39261ed 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -1627,6 +1627,7 @@ public: // TODO: clean up the following after we no longer support non-opaque pointer // types. bool getOpaquePointers(); + bool hasOpaquePointersValue(); void setOpaquePointers(bool OP); private: -- 2.46.0.windows.1