Skip to content

Commit f88c3c5

Browse files
committed
correct LLVMRustCreateThinLTOData arg types
1 parent be33e4f commit f88c3c5

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,9 @@ fn thin_lto(
502502
// upstream...
503503
let data = llvm::LLVMRustCreateThinLTOData(
504504
thin_modules.as_ptr(),
505-
thin_modules.len() as u32,
505+
thin_modules.len(),
506506
symbols_below_threshold.as_ptr(),
507-
symbols_below_threshold.len() as u32,
507+
symbols_below_threshold.len(),
508508
)
509509
.ok_or_else(|| write::llvm_err(dcx, LlvmError::PrepareThinLtoContext))?;
510510

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,9 +2385,9 @@ unsafe extern "C" {
23852385
pub fn LLVMRustThinLTOBufferThinLinkDataLen(M: &ThinLTOBuffer) -> size_t;
23862386
pub fn LLVMRustCreateThinLTOData(
23872387
Modules: *const ThinLTOModule,
2388-
NumModules: c_uint,
2388+
NumModules: size_t,
23892389
PreservedSymbols: *const *const c_char,
2390-
PreservedSymbolsLen: c_uint,
2390+
PreservedSymbolsLen: size_t,
23912391
) -> Option<&'static mut ThinLTOData>;
23922392
pub fn LLVMRustPrepareThinLTORename(
23932393
Data: &ThinLTOData,

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,12 +1251,13 @@ getFirstDefinitionForLinker(const GlobalValueSummaryList &GVSummaryList) {
12511251
// here is basically the same as before threads are spawned in the `run`
12521252
// function of `lib/LTO/ThinLTOCodeGenerator.cpp`.
12531253
extern "C" LLVMRustThinLTOData *
1254-
LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, int num_modules,
1255-
const char **preserved_symbols, int num_symbols) {
1254+
LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, size_t num_modules,
1255+
const char **preserved_symbols,
1256+
size_t num_symbols) {
12561257
auto Ret = std::make_unique<LLVMRustThinLTOData>();
12571258

12581259
// Load each module's summary and merge it into one combined index
1259-
for (int i = 0; i < num_modules; i++) {
1260+
for (size_t i = 0; i < num_modules; i++) {
12601261
auto module = &modules[i];
12611262
auto buffer = StringRef(module->data, module->len);
12621263
auto mem_buffer = MemoryBufferRef(buffer, module->identifier);
@@ -1275,7 +1276,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, int num_modules,
12751276

12761277
// Convert the preserved symbols set from string to GUID, this is then needed
12771278
// for internalization.
1278-
for (int i = 0; i < num_symbols; i++) {
1279+
for (size_t i = 0; i < num_symbols; i++) {
12791280
auto GUID = GlobalValue::getGUID(preserved_symbols[i]);
12801281
Ret->GUIDPreservedSymbols.insert(GUID);
12811282
}

0 commit comments

Comments
 (0)