llvm: fix crashes when loading a struct field

The result of buildStructGEP is not always a GEP (sorry), so we can't
use getGEPResultElementType on it.

Closes #14641
This commit is contained in:
Jacob Young
2023-03-29 21:22:14 -04:00
committed by Veikka Tuominen
parent ff97bd21c3
commit 0543def52f
5 changed files with 14 additions and 12 deletions

View File

@@ -1239,10 +1239,6 @@ void ZigLLVMSetCallElemTypeAttr(LLVMValueRef Call, size_t arg_index, LLVMTypeRef
Attribute::get(call_inst->getContext(), Attribute::ElementType, llvm_type));
}
LLVMTypeRef ZigLLVMGetGEPResultElementType(LLVMValueRef GEP) {
return wrap(unwrap<GEPOperator>(GEP)->getResultElementType());
}
void ZigLLVMFunctionSetPrefixData(LLVMValueRef function, LLVMValueRef data) {
unwrap<Function>(function)->setPrefixData(unwrap<Constant>(data));
}