Skip to content

Commit a43b98e

Browse files
build: Add compatibility with LLVM 20.1.3
This adds LLVM 21 compatibility. Signed-off-by: Christian Heusel <[email protected]>
1 parent 233a54a commit a43b98e

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ NEW or CHANGED minimum dependencies since the last major release are **bold**.
4949
$OpenImageIO_ROOT/lib to be in your LD_LIBRARY_PATH (or
5050
DYLD_LIBRARY_PATH on OS X).
5151

52-
* [LLVM](http://www.llvm.org) **14.0 or newer**, 15, 16, 17, 18, 19, 20,
52+
* [LLVM](http://www.llvm.org) **14.0 or newer**, 15, 16, 17, 18, 19, 20, 21,
5353
including clang libraries.
5454

5555
* (optional) For GPU rendering on NVIDIA GPUs:

src/cmake/externalpackages.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ checked_find_package (pugixml REQUIRED
5858
# LLVM library setup
5959
checked_find_package (LLVM REQUIRED
6060
VERSION_MIN 14.0
61-
VERSION_MAX 20.9
61+
VERSION_MAX 21.1.3
6262
PRINT LLVM_SYSTEM_LIBRARIES CLANG_LIBRARIES
6363
LLVM_SHARED_MODE)
6464
# ensure include directory is added (in case of non-standard locations

src/liboslcomp/oslcomp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,19 +171,19 @@ OSLCompilerImpl::preprocess_buffer(const std::string& buffer,
171171
llvm::raw_string_ostream errstream(preproc_errors);
172172
clang::DiagnosticOptions* diagOptions = new clang::DiagnosticOptions();
173173
clang::TextDiagnosticPrinter* diagPrinter
174-
= new clang::TextDiagnosticPrinter(errstream, diagOptions);
174+
= new clang::TextDiagnosticPrinter(errstream, *diagOptions);
175175
llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> diagIDs(
176176
new clang::DiagnosticIDs);
177177
clang::DiagnosticsEngine* diagEngine
178-
= new clang::DiagnosticsEngine(diagIDs, diagOptions, diagPrinter);
178+
= new clang::DiagnosticsEngine(diagIDs, *diagOptions, diagPrinter);
179179
inst.setDiagnostics(diagEngine);
180180

181181
const std::shared_ptr<clang::TargetOptions> targetopts
182182
= std::make_shared<clang::TargetOptions>(inst.getTargetOpts());
183183
targetopts->Triple = llvm::sys::getDefaultTargetTriple();
184184
clang::TargetInfo* target
185185
= clang::TargetInfo::CreateTargetInfo(inst.getDiagnostics(),
186-
targetopts);
186+
*targetopts);
187187

188188
inst.setTarget(target);
189189

src/liboslexec/llvm_instance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2225,7 +2225,7 @@ BackendLLVM::run()
22252225
// The triple is empty with recent versions of LLVM (e.g., 15) for reasons that aren't
22262226
// clear. So we must set them to the expected values.
22272227
// See: https://llvm.org/docs/NVPTXUsage.html
2228-
ll.module()->setTargetTriple("nvptx64-nvidia-cuda");
2228+
ll.module()->setTargetTriple(llvm::Triple("nvptx64-nvidia-cuda"));
22292229
ll.module()->setDataLayout(
22302230
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64");
22312231

0 commit comments

Comments
 (0)