Skip to content

Commit f7de4e8

Browse files
committed
Remove llvm 16 and 17 compatibility
1 parent 98e07e7 commit f7de4e8

File tree

16 files changed

+7
-3504
lines changed

16 files changed

+7
-3504
lines changed

.github/actions/Build_LLVM/action.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ runs:
4343
ninja LLVMOrcDebugging -j ${{ env.ncpus }}
4444
ninja clingInterpreter -j ${{ env.ncpus }}
4545
else
46-
# Apply patches
47-
llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]')
48-
if [[ "${llvm_vers}" == "16" ]]||[[ "${llvm_vers}" == "17" ]]; then
49-
git apply -v ../patches/llvm/clang${{ matrix.clang-runtime }}-*.patch
50-
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
51-
fi
5246
cd build
5347
cmake -DLLVM_ENABLE_PROJECTS="${{ matrix.llvm_enable_projects}}" \
5448
-DLLVM_TARGETS_TO_BUILD="${{ matrix.llvm_targets_to_build }}" \
@@ -132,18 +126,6 @@ runs:
132126
}
133127
else
134128
{
135-
cp -r ..\patches\llvm\clang${{ matrix.clang-runtime }}*
136-
#FIXME: Apply patches without hardcoding
137-
if ( "${{ matrix.clang-runtime }}" -imatch "16" )
138-
{
139-
git apply -v clang16-1-Value.patch
140-
git apply -v clang16-2-CUDA.patch
141-
git apply -v clang16-3-WeakRef.patch
142-
}
143-
elseif ( "${{ matrix.clang-runtime }}" -imatch "17" )
144-
{
145-
git apply -v clang17-1-NewOperator.patch
146-
}
147129
cd build
148130
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
149131
cmake -DLLVM_ENABLE_PROJECTS="${{ matrix.llvm_enable_projects}}" `

.github/workflows/main.yml

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,6 @@ jobs:
5656
cppyy: On
5757
llvm_enable_projects: "clang"
5858
llvm_targets_to_build: "host;NVPTX"
59-
- name: ubu24-arm-gcc12-clang-repl-17-cppyy
60-
os: ubuntu-24.04-arm
61-
compiler: gcc-12
62-
clang-runtime: '17'
63-
cling: Off
64-
cppyy: On
65-
llvm_enable_projects: "clang"
66-
llvm_targets_to_build: "host;NVPTX"
67-
- name: ubu24-arm-gcc12-clang-repl-16
68-
os: ubuntu-24.04-arm
69-
compiler: gcc-12
70-
clang-runtime: '16'
71-
cling: Off
72-
cppyy: Off
73-
llvm_enable_projects: "clang"
74-
llvm_targets_to_build: "host;NVPTX"
7559
- name: ubu24-arm-gcc9-clang18-cling-cppyy
7660
os: ubuntu-24.04-arm
7761
compiler: gcc-9
@@ -106,22 +90,6 @@ jobs:
10690
cppyy: On
10791
llvm_enable_projects: "clang"
10892
llvm_targets_to_build: "host;NVPTX"
109-
- name: ubu24-x86-gcc12-clang-repl-17-cppyy
110-
os: ubuntu-24.04
111-
compiler: gcc-12
112-
clang-runtime: '17'
113-
cling: Off
114-
cppyy: On
115-
llvm_enable_projects: "clang"
116-
llvm_targets_to_build: "host;NVPTX"
117-
- name: ubu24-x86-gcc12-clang-repl-16
118-
os: ubuntu-24.04
119-
compiler: gcc-12
120-
clang-runtime: '16'
121-
cling: Off
122-
cppyy: Off
123-
llvm_enable_projects: "clang"
124-
llvm_targets_to_build: "host;NVPTX"
12593
- name: ubu24-x86-gcc9-clang18-cling-cppyy
12694
os: ubuntu-24.04
12795
compiler: gcc-9
@@ -156,22 +124,6 @@ jobs:
156124
cppyy: On
157125
llvm_enable_projects: "clang"
158126
llvm_targets_to_build: "host"
159-
- name: osx15-arm-clang-clang-repl-17-cppyy
160-
os: macos-15
161-
compiler: clang
162-
clang-runtime: '17'
163-
cling: Off
164-
cppyy: On
165-
llvm_enable_projects: "clang"
166-
llvm_targets_to_build: "host"
167-
- name: osx15-arm-clang-clang-repl-16
168-
os: macos-15
169-
compiler: clang
170-
clang-runtime: '16'
171-
cling: Off
172-
cppyy: Off
173-
llvm_enable_projects: "clang"
174-
llvm_targets_to_build: "host"
175127
- name: osx15-arm-clang-clang18-cling-cppyy
176128
os: macos-15
177129
compiler: clang
@@ -206,21 +158,6 @@ jobs:
206158
cppyy: On
207159
llvm_enable_projects: "clang"
208160
llvm_targets_to_build: "host"
209-
- name: osx13-x86-clang-clang-repl-17-cppyy
210-
os: macos-13
211-
compiler: clang
212-
clang-runtime: '17'
213-
cling: Off
214-
cppyy: On
215-
llvm_enable_projects: "clang"
216-
llvm_targets_to_build: "host"
217-
- name: osx13-x86-clang-clang-repl-16
218-
os: macos-13
219-
compiler: clang
220-
clang-runtime: '16'
221-
cling: Off
222-
llvm_enable_projects: "clang"
223-
llvm_targets_to_build: "host"
224161
- name: osx13-x86-clang-clang18-cling-cppyy
225162
os: macos-13
226163
compiler: clang

.readthedocs.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ build:
99
tools:
1010
python: "3.11"
1111
apt_packages:
12-
- clang-16
12+
- clang-18
1313
- cmake
14-
- libclang-16-dev
15-
- llvm-16-dev
16-
- llvm-16-tools
14+
- libclang-18-dev
15+
- llvm-18-dev
16+
- llvm-18-tools

CMakeLists.txt

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,13 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
6767
include(GNUInstallDirs)
6868
## Define supported version of clang and llvm
6969

70-
if (CPPINTEROP_USE_CLING)
7170
set(CLANG_MIN_SUPPORTED 18.0)
72-
else()
73-
set(CLANG_MIN_SUPPORTED 16.0)
74-
endif(CPPINTEROP_USE_CLING)
7571
set(CLANG_MAX_SUPPORTED "20.1.x")
7672
set(CLANG_VERSION_UPPER_BOUND 21.0.0)
77-
if (CPPINTEROP_USE_CLING)
7873
set(LLD_MIN_SUPPORTED 18.0)
79-
else()
80-
set(LLD_MIN_SUPPORTED 16.0)
81-
endif(CPPINTEROP_USE_CLING)
8274
set(LLD_MAX_SUPPORTED "20.1.x")
8375
set(LLD_VERSION_UPPER_BOUND 21.0.0)
84-
if (CPPINTEROP_USE_CLING)
8576
set(LLVM_MIN_SUPPORTED 18.0)
86-
else()
87-
set(LLVM_MIN_SUPPORTED 16.0)
88-
endif(CPPINTEROP_USE_CLING)
8977
set(LLVM_MAX_SUPPORTED "20.1.x")
9078
set(LLVM_VERSION_UPPER_BOUND 21.0.0)
9179

@@ -242,7 +230,7 @@ endif()
242230
message(STATUS "Found supported version: Clang ${CLANG_PACKAGE_VERSION}")
243231
message(STATUS "Using ClangConfig.cmake in: ${Clang_DIR}")
244232

245-
## Clang 16 require c++17 or later.
233+
## Clang 18 require c++17 or later.
246234
if (NOT CMAKE_CXX_STANDARD)
247235
set (CMAKE_CXX_STANDARD 17)
248236
endif()

README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,6 @@ git clone --depth=1 --branch release/20.x https://github.com/llvm/llvm-project.g
105105
cd llvm-project
106106
```
107107

108-
For Clang 16 & 17, the following patches required for development work. To apply these patches on Linux and MacOS execute the following command(substitute `{version}` with your clang version):
109-
110-
```bash
111-
git apply -v ../CppInterOp/patches/llvm/clang{version}-*.patch
112-
```
113-
114-
and
115-
116-
```powershell
117-
cp -r ..\CppInterOp\patches\llvm\clang{version}* .
118-
git apply -v clang{version}-*.patch
119-
```
120-
121-
on Windows.
122-
123108
##### Build Clang-REPL
124109

125110
Clang-REPL is an interpreter that CppInterOp works alongside. Build Clang (and

docs/DevelopersDocumentation.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,6 @@ Clone the 20.x release of the LLVM project repository.
4141
git clone --depth=1 --branch release/20.x https://github.com/llvm/llvm-project.git
4242
cd llvm-project
4343
44-
For Clang 16 & 17, the following patches required for development work. To apply
45-
these patches on Linux and MacOS execute the following command(substitute
46-
`{version}` with your clang version):
47-
48-
.. code:: bash
49-
50-
git apply -v ../CppInterOp/patches/llvm/clang{version}-*.patch
51-
52-
and
53-
54-
.. code:: powershell
55-
56-
cp -r ..\CppInterOp\patches\llvm\clang17* .
57-
git apply -v clang{version}-*.patch
58-
59-
on Windows.
60-
6144
******************
6245
Build Clang-REPL
6346
******************

docs/InstallationAndUsage.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,6 @@ Clone the 20.x release of the LLVM project repository.
4141
git clone --depth=1 --branch release/20.x https://github.com/llvm/llvm-project.git
4242
cd llvm-project
4343
44-
For Clang 16 & 17, the following patches required for development work. To apply
45-
these patches on Linux and MacOS execute the following command(substitute
46-
`{version}` with your clang version):
47-
48-
.. code:: bash
49-
50-
git apply -v ../CppInterOp/patches/llvm/clang{version}-*.patch
51-
52-
and
53-
54-
.. code:: powershell
55-
56-
cp -r ..\CppInterOp\patches\llvm\clang17* .
57-
git apply -v clang{version}-*.patch
58-
59-
on Windows.
60-
6144
******************
6245
Build Clang-REPL
6346
******************

lib/CppInterOp/CXCppInterOp.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ CXCursorKind cxcursor_getCursorKindForDecl(const Decl* D) {
9090
default:
9191
if (const auto* TD = dyn_cast<TagDecl>(D)) {
9292
switch (TD->getTagKind()) {
93-
#if CLANG_VERSION_MAJOR >= 18
9493
case TagTypeKind::Interface: // fall through
9594
case TagTypeKind::Struct:
9695
return CXCursor_StructDecl;
@@ -100,17 +99,6 @@ CXCursorKind cxcursor_getCursorKindForDecl(const Decl* D) {
10099
return CXCursor_UnionDecl;
101100
case TagTypeKind::Enum:
102101
return CXCursor_EnumDecl;
103-
#else
104-
case TagTypeKind::TTK_Interface: // fall through
105-
case TagTypeKind::TTK_Struct:
106-
return CXCursor_StructDecl;
107-
case TagTypeKind::TTK_Class:
108-
return CXCursor_ClassDecl;
109-
case TagTypeKind::TTK_Union:
110-
return CXCursor_UnionDecl;
111-
case TagTypeKind::TTK_Enum:
112-
return CXCursor_EnumDecl;
113-
#endif
114102
}
115103
}
116104
}

lib/CppInterOp/Compatibility.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,7 @@ static inline char* GetEnv(const char* Var_Name) {
5959
CXXSpecialMemberKind::MoveConstructor
6060
#endif
6161

62-
#if LLVM_VERSION_MAJOR < 18
63-
#define starts_with startswith
64-
#define ends_with endswith
65-
#endif
66-
67-
#if CLANG_VERSION_MAJOR >= 18
6862
#include "clang/Interpreter/CodeCompletion.h"
69-
#endif
7063

7164
#include "llvm/ADT/SmallString.h"
7265
#include "llvm/ADT/StringRef.h"
@@ -342,7 +335,6 @@ inline void codeComplete(std::vector<std::string>& Results,
342335
clang::Interpreter& I, const char* code,
343336
unsigned complete_line = 1U,
344337
unsigned complete_column = 1U) {
345-
#if CLANG_VERSION_MAJOR >= 18
346338
// FIXME: We should match the invocation arguments of the main interpreter.
347339
// That can affect the returned completion results.
348340
auto CB = clang::IncrementalCompilerBuilder();
@@ -366,9 +358,6 @@ inline void codeComplete(std::vector<std::string>& Results,
366358
for (llvm::StringRef r : results)
367359
if (r.find(CC.Prefix) == 0)
368360
Results.push_back(r.str());
369-
#else
370-
assert(false && "CodeCompletion API only available in Clang >= 18.");
371-
#endif
372361
}
373362

374363
} // namespace compat

lib/CppInterOp/CppInterOp.cpp

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -215,20 +215,10 @@ std::string GetVersion() {
215215
}
216216

217217
std::string Demangle(const std::string& mangled_name) {
218-
#if CLANG_VERSION_MAJOR > 16
219218
#ifdef _WIN32
220219
std::string demangle = microsoftDemangle(mangled_name, nullptr, nullptr);
221220
#else
222221
std::string demangle = itaniumDemangle(mangled_name);
223-
#endif
224-
#else
225-
#ifdef _WIN32
226-
std::string demangle = microsoftDemangle(mangled_name.c_str(), nullptr,
227-
nullptr, nullptr, nullptr);
228-
#else
229-
std::string demangle =
230-
itaniumDemangle(mangled_name.c_str(), nullptr, nullptr, nullptr);
231-
#endif
232222
#endif
233223
return demangle;
234224
}
@@ -574,9 +564,7 @@ std::string GetQualifiedCompleteName(TCppType_t klass) {
574564
PrintingPolicy PP = C.getPrintingPolicy();
575565
PP.FullyQualifiedName = true;
576566
PP.SuppressUnwrittenScope = true;
577-
#if CLANG_VERSION_MAJOR > 16
578567
PP.SuppressElaboration = true;
579-
#endif
580568
QT.getAsStringInternal(type_name, PP);
581569

582570
return type_name;
@@ -1689,9 +1677,7 @@ std::string GetTypeAsString(TCppType_t var) {
16891677
PrintingPolicy Policy((LangOptions()));
16901678
Policy.Bool = true; // Print bool instead of _Bool.
16911679
Policy.SuppressTagKeyword = true; // Do not print `class std::string`.
1692-
#if CLANG_VERSION_MAJOR > 16
16931680
Policy.SuppressElaboration = true;
1694-
#endif
16951681
Policy.FullyQualifiedName = true;
16961682
return compat::FixTypeName(QT.getAsString(Policy));
16971683
}
@@ -1834,9 +1820,7 @@ void get_type_as_string(QualType QT, std::string& type_name, ASTContext& C,
18341820
// cling::utils::Transform::GetPartiallyDesugaredType()
18351821
if (!QT->isTypedefNameType() || QT->isBuiltinType())
18361822
QT = QT.getDesugaredType(C);
1837-
#if CLANG_VERSION_MAJOR > 16
18381823
Policy.SuppressElaboration = true;
1839-
#endif
18401824
Policy.SuppressTagKeyword = !QT->isEnumeralType();
18411825
Policy.FullyQualifiedName = true;
18421826
QT.getAsStringInternal(type_name, Policy);
@@ -1876,9 +1860,7 @@ void collect_type_info(const FunctionDecl* FD, QualType& QT,
18761860
//
18771861
ASTContext& C = FD->getASTContext();
18781862
PrintingPolicy Policy(C.getPrintingPolicy());
1879-
#if CLANG_VERSION_MAJOR > 16
18801863
Policy.SuppressElaboration = true;
1881-
#endif
18821864
refType = kNotReference;
18831865
if (QT->isRecordType() && forArgument) {
18841866
get_type_as_string(QT, type_name, C, Policy);
@@ -2092,9 +2074,7 @@ void make_narg_call(const FunctionDecl* FD, const std::string& return_type,
20922074
PrintingPolicy PP = FD->getASTContext().getPrintingPolicy();
20932075
PP.FullyQualifiedName = true;
20942076
PP.SuppressUnwrittenScope = true;
2095-
#if CLANG_VERSION_MAJOR > 16
20962077
PP.SuppressElaboration = true;
2097-
#endif
20982078
FD->getNameForDiagnostic(stream, PP,
20992079
/*Qualified=*/false);
21002080

@@ -3353,11 +3333,7 @@ bool InsertOrReplaceJitSymbol(compat::Interpreter& I,
33533333
auto Symbol = compat::getSymbolAddress(I, linker_mangled_name);
33543334
llvm::orc::LLJIT& Jit = *compat::getExecutionEngine(I);
33553335
llvm::orc::ExecutionSession& ES = Jit.getExecutionSession();
3356-
#if CLANG_VERSION_MAJOR < 17
3357-
JITDylib& DyLib = Jit.getMainJITDylib();
3358-
#else
33593336
JITDylib& DyLib = *Jit.getProcessSymbolsJITDylib().get();
3360-
#endif // CLANG_VERSION_MAJOR
33613337

33623338
if (Error Err = Symbol.takeError()) {
33633339
logAllUnhandledErrors(std::move(Err), errs(),
@@ -3385,12 +3361,7 @@ bool InsertOrReplaceJitSymbol(compat::Interpreter& I,
33853361
}
33863362
auto Name = ES.intern(tmp);
33873363
InjectedSymbols[Name] =
3388-
#if CLANG_VERSION_MAJOR < 17
3389-
JITEvaluatedSymbol(address,
3390-
#else
3391-
ExecutorSymbolDef(ExecutorAddr(address),
3392-
#endif // CLANG_VERSION_MAJOR < 17
3393-
JITSymbolFlags::Exported);
3364+
ExecutorSymbolDef(ExecutorAddr(address), JITSymbolFlags::Exported);
33943365

33953366
// We want to replace a symbol with a custom provided one.
33963367
if (Symbol && address)

0 commit comments

Comments
 (0)