Handle more error cases if the user tries to declare a method.
This commit is contained in:
6
ctx.cpp
6
ctx.cpp
@@ -2653,10 +2653,14 @@ FunctionEmitContext::maskedStore(llvm::Value *value, llvm::Value *ptr,
|
|||||||
// individually with what turns into a recursive call to
|
// individually with what turns into a recursive call to
|
||||||
// makedStore()
|
// makedStore()
|
||||||
for (int i = 0; i < collectionType->GetElementCount(); ++i) {
|
for (int i = 0; i < collectionType->GetElementCount(); ++i) {
|
||||||
|
const Type *eltType = collectionType->GetElementType(i);
|
||||||
|
if (eltType == NULL) {
|
||||||
|
Assert(m->errorCount > 0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
llvm::Value *eltValue = ExtractInst(value, i, "value_member");
|
llvm::Value *eltValue = ExtractInst(value, i, "value_member");
|
||||||
llvm::Value *eltPtr =
|
llvm::Value *eltPtr =
|
||||||
AddElementOffset(ptr, i, ptrType, "struct_ptr_ptr");
|
AddElementOffset(ptr, i, ptrType, "struct_ptr_ptr");
|
||||||
const Type *eltType = collectionType->GetElementType(i);
|
|
||||||
const Type *eltPtrType = PointerType::GetUniform(eltType);
|
const Type *eltPtrType = PointerType::GetUniform(eltType);
|
||||||
StoreInst(eltValue, eltPtr, mask, eltType, eltPtrType);
|
StoreInst(eltValue, eltPtr, mask, eltType, eltPtrType);
|
||||||
}
|
}
|
||||||
|
|||||||
7
type.cpp
7
type.cpp
@@ -1820,6 +1820,7 @@ StructType::StructType(const std::string &n, const llvm::SmallVector<const Type
|
|||||||
else if (CastType<FunctionType>(type) != NULL) {
|
else if (CastType<FunctionType>(type) != NULL) {
|
||||||
Error(elementPositions[i], "Method declarations are not "
|
Error(elementPositions[i], "Method declarations are not "
|
||||||
"supported.");
|
"supported.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
elementTypes.push_back(type->LLVMType(g->ctx));
|
elementTypes.push_back(type->LLVMType(g->ctx));
|
||||||
@@ -2904,7 +2905,11 @@ FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool includeMask) const {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return llvm::FunctionType::get(returnType->LLVMType(g->ctx), callTypes, false);
|
llvm::Type *llvmReturnType = returnType->LLVMType(g->ctx);
|
||||||
|
if (llvmReturnType == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return llvm::FunctionType::get(llvmReturnType, callTypes, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user