Verifier: Make sure !llvm.ident's operand isn't null

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228815 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2015-02-11 08:23:20 +00:00
parent 94d09cbb9f
commit e37f2a0dc6
2 changed files with 10 additions and 1 deletions

View File

@ -818,7 +818,7 @@ void Verifier::visitModuleIdents(const Module &M) {
const MDNode *N = Idents->getOperand(i);
Assert1(N->getNumOperands() == 1,
"incorrect number of operands in llvm.ident metadata", N);
Assert1(isa<MDString>(N->getOperand(0)),
Assert1(dyn_cast_or_null<MDString>(N->getOperand(0)),
("invalid value for llvm.ident metadata entry operand"
"(the operand should be a string)"),
N->getOperand(0));

View File

@ -0,0 +1,9 @@
; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
; Verify that llvm.ident is properly structured.
; llvm.ident takes a list of metadata entries.
; Each metadata entry can contain one string only.
!llvm.ident = !{!0}
!0 = !{null}
; CHECK: assembly parsed, but does not verify as correct!
; CHECK-NEXT: invalid value for llvm.ident metadata entry operand(the operand should be a string)