[PATCH] Add error for unsized type

Hi all,

Attached is a simple patch that adds a more specific error when you have an unsized type in a gep.

Turns

$ echo “@g = global i64 ptrtoint(%C* getelementptr(%C* null, i32 1) to i64)” | opt -S
opt: :1:30: error: invalid indices for getelementptr
@g = global i64 ptrtoint(%C* getelementptr(%C* null, i32 1) to i64)

into

$ echo “@g = global i64 ptrtoint(%C* getelementptr(%C* null, i32 1) to i64)” | opt -S
Debug+Asserts/bin/opt: :1:30: error: unsized type in getelementptr
@g = global i64 ptrtoint(%C* getelementptr(%C* null, i32 1) to i64)

Thanks
Joey

unsized_type.diff (1.46 KB)