[llvm] [orc-rt] Merge ExternC.h and Visibility.h into Compiler.h. (PR #203673)
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 22:09:07 PDT 2026
https://github.com/lhames created https://github.com/llvm/llvm-project/pull/203673
This mirrors the combined orc-rt/Compiler.h header on the C++ side, and provides a natural home for future decoration macros when they're added.
>From d19571b2b8a800abf5db25075f936f7be419a9d7 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Sat, 13 Jun 2026 12:08:32 +1000
Subject: [PATCH] [orc-rt] Merge ExternC.h and Visibility.h into Compiler.h.
This mirrors the combined orc-rt/Compiler.h header on the C++ side, and
provides a natural home for future decoration macros when they're added.
---
orc-rt/include/CMakeLists.txt | 2 +-
.../orc-rt-c/{ExternC.h => Compiler.h} | 20 +++++++++----
orc-rt/include/orc-rt-c/CoreTypes.h | 2 +-
orc-rt/include/orc-rt-c/Error.h | 3 +-
orc-rt/include/orc-rt-c/Visibility.h | 30 -------------------
orc-rt/include/orc-rt-c/WrapperFunction.h | 2 +-
6 files changed, 19 insertions(+), 40 deletions(-)
rename orc-rt/include/orc-rt-c/{ExternC.h => Compiler.h} (76%)
delete mode 100644 orc-rt/include/orc-rt-c/Visibility.h
diff --git a/orc-rt/include/CMakeLists.txt b/orc-rt/include/CMakeLists.txt
index a8c9428696277..61c0c534b8327 100644
--- a/orc-rt/include/CMakeLists.txt
+++ b/orc-rt/include/CMakeLists.txt
@@ -1,7 +1,7 @@
set(ORC_RT_HEADERS
orc-rt-c/CoreTyspe.h
orc-rt-c/Error.h
- orc-rt-c/ExternC.h
+ orc-rt-c/Compiler.h
orc-rt-c/WrapperFunction.h
orc-rt-c/orc-rt.h
orc-rt/AllocAction.h
diff --git a/orc-rt/include/orc-rt-c/ExternC.h b/orc-rt/include/orc-rt-c/Compiler.h
similarity index 76%
rename from orc-rt/include/orc-rt-c/ExternC.h
rename to orc-rt/include/orc-rt-c/Compiler.h
index 27275a61b9b89..3a326978c6004 100644
--- a/orc-rt/include/orc-rt-c/ExternC.h
+++ b/orc-rt/include/orc-rt-c/Compiler.h
@@ -1,4 +1,4 @@
-/*===- ExternC.h - C API for the ORC runtime ----------------------*- C -*-===*\
+/*===-- Compiler.h - Compiler abstractions for the ORC RT C API ---*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
@@ -7,12 +7,12 @@
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
-|* This file defines the C API for the ORC runtime *|
+|* Compiler-abstraction macros used by the ORC runtime C API headers. *|
|* *|
\*===----------------------------------------------------------------------===*/
-#ifndef ORC_RT_C_EXTERNC_H
-#define ORC_RT_C_EXTERNC_H
+#ifndef ORC_RT_C_COMPILER_H
+#define ORC_RT_C_COMPILER_H
/* Helper to promote strict prototype warnings to errors */
#ifdef __clang__
@@ -38,4 +38,14 @@
#define ORC_RT_C_EXTERN_C_END ORC_RT_C_STRICT_PROTOTYPES_END
#endif
-#endif /* ORC_RT_C_EXTERNC_H */
+/* ORC_RT_C_ABI is the export/visibility macro used to mark symbols declared
+ in orc-rt-c as exported when built as a shared library. */
+#if defined(__has_attribute) && __has_attribute(visibility)
+#define ORC_RT_C_ABI __attribute__((visibility("default")))
+#endif
+
+#if !defined(ORC_RT_C_ABI)
+#define ORC_RT_C_ABI
+#endif
+
+#endif /* ORC_RT_C_COMPILER_H */
diff --git a/orc-rt/include/orc-rt-c/CoreTypes.h b/orc-rt/include/orc-rt-c/CoreTypes.h
index a0f80b3bfc21e..1384ec88f4394 100644
--- a/orc-rt/include/orc-rt-c/CoreTypes.h
+++ b/orc-rt/include/orc-rt-c/CoreTypes.h
@@ -14,7 +14,7 @@
#ifndef ORC_RT_C_CORETYPES_H
#define ORC_RT_C_CORETYPES_H
-#include "orc-rt-c/ExternC.h"
+#include "orc-rt-c/Compiler.h"
ORC_RT_C_EXTERN_C_BEGIN
diff --git a/orc-rt/include/orc-rt-c/Error.h b/orc-rt/include/orc-rt-c/Error.h
index 81f088214dd0a..97ecda90de5cf 100644
--- a/orc-rt/include/orc-rt-c/Error.h
+++ b/orc-rt/include/orc-rt-c/Error.h
@@ -16,9 +16,8 @@
#ifndef ORC_RT_C_ERROR_H
#define ORC_RT_C_ERROR_H
+#include "orc-rt-c/Compiler.h"
#include "orc-rt-c/CoreTypes.h"
-#include "orc-rt-c/ExternC.h"
-#include "orc-rt-c/Visibility.h"
ORC_RT_C_EXTERN_C_BEGIN
diff --git a/orc-rt/include/orc-rt-c/Visibility.h b/orc-rt/include/orc-rt-c/Visibility.h
deleted file mode 100644
index 76e1a4706c2a4..0000000000000
--- a/orc-rt/include/orc-rt-c/Visibility.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*===--- Visibility.h - Visibility macros for the ORC runtime ---*- C++ -*-===*\
-|* *|
-|* 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 *|
-|* *|
-|*===----------------------------------------------------------------------===*|
-|* *|
-|* This header defines visibility macros used for the ORC runtime C interface.*|
-|* These macros are used to annotate C functions that should be exported as *|
-|* part of a shared library or DLL. *|
-|* *|
-\*===----------------------------------------------------------------------===*/
-
-#ifndef ORC_RT_C_VISIBILITY_H
-#define ORC_RT_C_VISIBILITY_H
-
-/* ORC_RT_C_ABI is the export/visibility macro used to mark symbols declared
- in orc-rt-c as exported when built as a shared library. */
-
-#if defined(__has_attribute) && __has_attribute(visibility)
-#define ORC_RT_C_ABI __attribute__((visibility("default")))
-#endif
-
-#if !defined(ORC_RT_C_ABI)
-#define ORC_RT_C_ABI
-#endif
-
-#endif /* ORC_RT_C_VISIBILITY_H */
diff --git a/orc-rt/include/orc-rt-c/WrapperFunction.h b/orc-rt/include/orc-rt-c/WrapperFunction.h
index 66e692e28923c..aa5f50fae87f5 100644
--- a/orc-rt/include/orc-rt-c/WrapperFunction.h
+++ b/orc-rt/include/orc-rt-c/WrapperFunction.h
@@ -14,8 +14,8 @@
#ifndef ORC_RT_C_WRAPPERFUNCTION_H
#define ORC_RT_C_WRAPPERFUNCTION_H
+#include "orc-rt-c/Compiler.h"
#include "orc-rt-c/CoreTypes.h"
-#include "orc-rt-c/ExternC.h"
#include <assert.h>
#include <stdint.h>
More information about the llvm-commits
mailing list