OSDN Git Service

turn an assert into a proper check, fixing crash on invalid here:
authorChris Lattner <sabre@nondot.org>
Sat, 10 Apr 2010 18:01:25 +0000 (18:01 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 10 Apr 2010 18:01:25 +0000 (18:01 +0000)
$ llvm-as t.ll
llvm-as: t.ll:1:6: error: expected 'type' after '='
%0 = = type { i32, float, float, double }
     ^

PR6810.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100934 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/LLParser.cpp

index 7eff9cc..fe8e9c7 100644 (file)
@@ -322,9 +322,8 @@ bool LLParser::ParseUnnamedType() {
       return true;
   }
 
-  assert(Lex.getKind() == lltok::kw_type);
   LocTy TypeLoc = Lex.getLoc();
-  Lex.Lex(); // eat kw_type
+  if (ParseToken(lltok::kw_type, "expected 'type' after '='")) return true;
 
   PATypeHolder Ty(Type::getVoidTy(Context));
   if (ParseType(Ty)) return true;