[libclc] 0d65856 - libclc: Remove HAVE_LLVM version macros (#158257)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 12 03:09:02 PDT 2025
Author: Matt Arsenault
Date: 2025-09-12T19:08:57+09:00
New Revision: 0d65856584dffafbc417919d8fcb8ad66f9fbf8a
URL: https://github.com/llvm/llvm-project/commit/0d65856584dffafbc417919d8fcb8ad66f9fbf8a
DIFF: https://github.com/llvm/llvm-project/commit/0d65856584dffafbc417919d8fcb8ad66f9fbf8a.diff
LOG: libclc: Remove HAVE_LLVM version macros (#158257)
This doesn't need to pretend to support multiple versions of llvm
and these are old anyway.
Added:
Modified:
libclc/utils/CMakeLists.txt
libclc/utils/prepare-builtins.cpp
Removed:
################################################################################
diff --git a/libclc/utils/CMakeLists.txt b/libclc/utils/CMakeLists.txt
index 6851ae16bda07..a14d133985a64 100644
--- a/libclc/utils/CMakeLists.txt
+++ b/libclc/utils/CMakeLists.txt
@@ -1,6 +1,3 @@
-# Construct LLVM version define
-set( LLVM_VERSION_DEFINE "-DHAVE_LLVM=0x${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}" )
-
# Setup prepare_builtins tools
set( LLVM_LINK_COMPONENTS
BitReader
@@ -19,6 +16,5 @@ else()
setup_host_tool( prepare_builtins PREPARE_BUILTINS prepare_builtins_exe prepare_builtins_target )
endif()
-target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
# These were not properly reported in early LLVM and we don't need them
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
diff --git a/libclc/utils/prepare-builtins.cpp b/libclc/utils/prepare-builtins.cpp
index b10dfccc6d88c..40a5445ef507f 100644
--- a/libclc/utils/prepare-builtins.cpp
+++ b/libclc/utils/prepare-builtins.cpp
@@ -6,12 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#if HAVE_LLVM > 0x0390
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Bitcode/BitcodeWriter.h"
-#else
-#include "llvm/Bitcode/ReaderWriter.h"
-#endif
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/Function.h"
@@ -62,12 +58,8 @@ int main(int argc, char **argv) {
std::unique_ptr<MemoryBuffer> &BufferPtr = BufferOrErr.get();
SMDiagnostic Err;
std::unique_ptr<llvm::Module> MPtr =
-#if HAVE_LLVM > 0x0390
ExitOnErr(Expected<std::unique_ptr<llvm::Module>>(
parseIR(BufferPtr.get()->getMemBufferRef(), Err, Context)));
-#else
- parseIR(BufferPtr.get()->getMemBufferRef(), Err, Context);
-#endif
M = MPtr.release();
}
}
@@ -106,13 +98,8 @@ int main(int argc, char **argv) {
}
std::error_code EC;
-#if HAVE_LLVM >= 0x0600
std::unique_ptr<ToolOutputFile> Out(
new ToolOutputFile(OutputFilename, EC, sys::fs::OF_None));
-#else
- std::unique_ptr<tool_output_file> Out(
- new tool_output_file(OutputFilename, EC, sys::fs::OF_None));
-#endif
if (EC) {
errs() << EC.message() << '\n';
exit(1);
@@ -121,11 +108,7 @@ int main(int argc, char **argv) {
if (TextualOut)
M->print(Out->os(), nullptr, true);
else
-#if HAVE_LLVM >= 0x0700
WriteBitcodeToFile(*M, Out->os());
-#else
- WriteBitcodeToFile(M, Out->os());
-#endif
// Declare success.
Out->keep();
More information about the cfe-commits
mailing list