diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-08 19:56:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-08 19:56:22 +0000 |
commit | b4bd16fc5e3dd416cf68e73cff93544d364159d6 (patch) | |
tree | a0b2ac5eb64bfd4c688d863c71d819093ee7ec75 /lib/AsmParser/LLParser.cpp | |
parent | 0fd4a27ec0b4c890c3c0deb36ef0896a4400ea4d (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64089 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/LLParser.cpp')
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 60e863c53e..3201e9887c 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -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")) |