From dcdb9ad3d27aca6185af64f2e0318ed47860c6c0 Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Tue, 16 Mar 2021 16:32:00 -0400 Subject: llvm-wrapper: pass std::string instead of StringRef LLVM change 5fbd1a333aa1a0b70903d036b98ea56c51ae5224 modified this function to want std::string instead of StringRef, which is easily done. --- compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp') diff --git a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp index e97d96e3a4e..67074685cf6 100644 --- a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp @@ -23,10 +23,17 @@ extern "C" void LLVMRustCoverageWriteFilenamesSectionToBuffer( const char* const Filenames[], size_t FilenamesLen, RustStringRef BufferOut) { +#if LLVM_VERSION_GE(12,0) + SmallVector FilenameRefs; + for (size_t i = 0; i < FilenamesLen; i++) { + FilenameRefs.push_back(std::string(Filenames[i])); + } +#else SmallVector FilenameRefs; for (size_t i = 0; i < FilenamesLen; i++) { FilenameRefs.push_back(StringRef(Filenames[i])); } +#endif auto FilenamesWriter = coverage::CoverageFilenamesSectionWriter( makeArrayRef(FilenameRefs)); RawRustStringOstream OS(BufferOut); -- cgit 1.4.1-3-g733a5 From babe894bab47e43c2a884fe367095905e4e88993 Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Fri, 19 Mar 2021 16:46:40 -0400 Subject: fix: I meant LLVM version 13, not 12 --- compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | 2 +- compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 2 +- compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp') diff --git a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp index 67074685cf6..35cca04b20f 100644 --- a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp @@ -23,7 +23,7 @@ extern "C" void LLVMRustCoverageWriteFilenamesSectionToBuffer( const char* const Filenames[], size_t FilenamesLen, RustStringRef BufferOut) { -#if LLVM_VERSION_GE(12,0) +#if LLVM_VERSION_GE(13,0) SmallVector FilenameRefs; for (size_t i = 0; i < FilenamesLen; i++) { FilenameRefs.push_back(std::string(Filenames[i])); diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index eaccbfd6373..f1a898b324c 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -1437,7 +1437,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, Ret->ResolvedODR[ModuleIdentifier][GUID] = NewLinkage; }; -#if LLVM_VERSION_GE(12,0) +#if LLVM_VERSION_GE(13,0) lto::Config conf; thinLTOResolvePrevailingInIndex(conf, Ret->Index, isPrevailing, recordNewLinkage, Ret->GUIDPreservedSymbols); diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 9aa6d202cb5..d33bce51f02 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -382,7 +382,7 @@ LLVMRustBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Target, LLVMValueRef Old, LLVMValueRef Source, LLVMAtomicOrdering Order, LLVMAtomicOrdering FailureOrder, LLVMBool Weak) { -#if LLVM_VERSION_GE(12,0) +#if LLVM_VERSION_GE(13,0) AtomicCmpXchgInst *ACXI = unwrap(B)->CreateAtomicCmpXchg( unwrap(Target), unwrap(Old), unwrap(Source), llvm::MaybeAlign(), fromRust(Order), fromRust(FailureOrder)); -- cgit 1.4.1-3-g733a5