[llvm] r224056 - AsmParser: Don't crash on an ill-formed MDNodeVector
David Majnemer
david.majnemer at gmail.com
Thu Dec 11 12:51:54 PST 2014
Author: majnemer
Date: Thu Dec 11 14:51:54 2014
New Revision: 224056
URL: http://llvm.org/viewvc/llvm-project?rev=224056&view=rev
Log:
AsmParser: Don't crash on an ill-formed MDNodeVector
Added:
llvm/trunk/test/Assembler/invalid-mdnode-vector2.ll
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=224056&r1=224055&r2=224056&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Dec 11 14:51:54 2014
@@ -2968,8 +2968,8 @@ bool LLParser::ParseMetadataAsValue(ValI
/// ::= !{...}
/// ::= !"string"
bool LLParser::ParseMetadata(Metadata *&MD, PerFunctionState *PFS) {
- assert(Lex.getKind() == lltok::exclaim);
- Lex.Lex();
+ if (ParseToken(lltok::exclaim, "expected '!' here"))
+ return true;
// MDNode:
// !{ ... }
Added: llvm/trunk/test/Assembler/invalid-mdnode-vector2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-mdnode-vector2.ll?rev=224056&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/invalid-mdnode-vector2.ll (added)
+++ llvm/trunk/test/Assembler/invalid-mdnode-vector2.ll Thu Dec 11 14:51:54 2014
@@ -0,0 +1,4 @@
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+
+!0 = metadata !{metadata
+; CHECK: expected '!' here
More information about the llvm-commits
mailing list