diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-06 23:13:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-06 23:13:49 +0100 |
| commit | e434f613fddec939f357e5afad79c90b6fc4a7a1 (patch) | |
| tree | a779d29d5b394833ef23a82ec26a7ac60730f570 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | b28d30e1e3c2b90fd08b7dd79d8e63884d1e0339 (diff) | |
| parent | 75aec4703dea7ef8e13924ccfa3a3d2e8c5c7cff (diff) | |
| download | rust-e434f613fddec939f357e5afad79c90b6fc4a7a1.tar.gz rust-e434f613fddec939f357e5afad79c90b6fc4a7a1.zip | |
Rollup merge of #105298 - krasimirgg:llvm-16-dec-1, r=cuviper
llvm-wrapper: adapt for an LLVM API change Adapts llvm-wrapper for https://github.com/llvm/llvm-project/commit/8c7c20f033c7036a8bf231ca6f9e02172cb581f0. No functional changes intended. Found via our experimental rust + llvm @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15404#0184d95d-5a68-4db6-ad32-51ddbc3ab543/202-571
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 792d921c6a4..3a748f38995 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -17,7 +17,9 @@ #include "llvm/Pass.h" #include "llvm/Bitcode/BitcodeWriter.h" #include "llvm/Support/Signals.h" +#if LLVM_VERSION_LT(16, 0) #include "llvm/ADT/Optional.h" +#endif #include <iostream> @@ -708,7 +710,11 @@ enum class LLVMRustChecksumKind { SHA256, }; +#if LLVM_VERSION_LT(16, 0) static Optional<DIFile::ChecksumKind> fromRust(LLVMRustChecksumKind Kind) { +#else +static std::optional<DIFile::ChecksumKind> fromRust(LLVMRustChecksumKind Kind) { +#endif switch (Kind) { case LLVMRustChecksumKind::None: return None; @@ -787,8 +793,18 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFile( const char *Filename, size_t FilenameLen, const char *Directory, size_t DirectoryLen, LLVMRustChecksumKind CSKind, const char *Checksum, size_t ChecksumLen) { + +#if LLVM_VERSION_LT(16, 0) Optional<DIFile::ChecksumKind> llvmCSKind = fromRust(CSKind); +#else + std::optional<DIFile::ChecksumKind> llvmCSKind = fromRust(CSKind); +#endif + +#if LLVM_VERSION_LT(16, 0) Optional<DIFile::ChecksumInfo<StringRef>> CSInfo{}; +#else + std::optional<DIFile::ChecksumInfo<StringRef>> CSInfo{}; +#endif if (llvmCSKind) CSInfo.emplace(*llvmCSKind, StringRef{Checksum, ChecksumLen}); return wrap(Builder->createFile(StringRef(Filename, FilenameLen), |
