[llvm-commits] [llvm] r64089 - /llvm/trunk/lib/AsmParser/LLParser.cpp

Nick Lewycky nicholas at mxc.ca
Sun Feb 8 11:58:28 PST 2009


Chris Lattner wrote:
> Author: lattner
> Date: Sun Feb  8 13:56:22 2009
> New Revision: 64089
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=64089&view=rev
> Log:
> 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.
> 
> 
> Modified:
>     llvm/trunk/lib/AsmParser/LLParser.cpp
> 
> Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=64089&r1=64088&r2=64089&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
> +++ llvm/trunk/lib/AsmParser/LLParser.cpp Sun Feb  8 13:56:22 2009
> @@ -465,7 +465,7 @@
>        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");

'invalid'

Nick

>    
>    GlobalVariable *GV = 0;
> @@ -1024,6 +1024,8 @@
>      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 @@
>      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"))
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 




More information about the llvm-commits mailing list