rustllvm: Add LLVMRustArrayType
LLVM internally uses `uint64_t` for array size, but the corresponding C API (`LLVMArrayType`) uses `unsigned int` so ths value is truncated. Therefore rustc generates wrong type for fixed-sized large vector e.g. `[0 x i8]` for `[0u8, ..(1 << 32)]`. This patch adds `LLVMRustArrayType` function for `uint64_t` support.
This commit is contained in:
parent
6878039c12
commit
9f7caed202
4 changed files with 21 additions and 4 deletions
|
@ -754,3 +754,9 @@ LLVMRustGetSectionName(LLVMSectionIteratorRef SI, const char **ptr) {
|
|||
*ptr = ret.data();
|
||||
return ret.size();
|
||||
}
|
||||
|
||||
// LLVMArrayType function does not support 64-bit ElementCount
|
||||
extern "C" LLVMTypeRef
|
||||
LLVMRustArrayType(LLVMTypeRef ElementType, uint64_t ElementCount) {
|
||||
return wrap(ArrayType::get(unwrap(ElementType), ElementCount));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue