reject void pointers with a nice error:

llvm-as: t.ll:2:15: pointers to void are invalid, use i8* instead
%X = type void*
              ^

instead of asserting and dying.

llvm-svn: 64089
This commit is contained in:
Chris Lattner 2009-02-08 19:56:22 +00:00
parent 4a51a59a4b
commit 803ee40d44

View File

@ -465,7 +465,7 @@ bool LLParser::ParseGlobal(const std::string &Name, LocTy NameLoc,
return true;
}
if (isa<FunctionType>(Ty) || Ty == Type::LabelTy)
if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || Ty == Type::VoidTy)
return Error(TyLoc, "invald type for global variable");
GlobalVariable *GV = 0;
@ -1024,6 +1024,8 @@ bool LLParser::ParseTypeRec(PATypeHolder &Result) {
case lltok::star:
if (Result.get() == Type::LabelTy)
return TokError("basic block pointers are invalid");
if (Result.get() == Type::VoidTy)
return TokError("pointers to void are invalid, use i8* instead");
Result = HandleUpRefs(PointerType::getUnqual(Result.get()));
Lex.Lex();
break;
@ -1032,6 +1034,8 @@ bool LLParser::ParseTypeRec(PATypeHolder &Result) {
case lltok::kw_addrspace: {
if (Result.get() == Type::LabelTy)
return TokError("basic block pointers are invalid");
if (Result.get() == Type::VoidTy)
return TokError("pointers to void are invalid, use i8* instead");
unsigned AddrSpace;
if (ParseOptionalAddrSpace(AddrSpace) ||
ParseToken(lltok::star, "expected '*' in address space"))