Verifier: Diagnose module flags which have null ID operands

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229361 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2015-02-16 08:14:22 +00:00
parent 74b9ad3485
commit 815c05d38c
2 changed files with 7 additions and 1 deletions

View File

@ -877,7 +877,7 @@ Verifier::visitModuleFlag(const MDNode *Op,
"invalid behavior operand in module flag (unexpected constant)",
Op->getOperand(0));
}
MDString *ID = dyn_cast<MDString>(Op->getOperand(1));
MDString *ID = dyn_cast_or_null<MDString>(Op->getOperand(1));
Assert1(ID,
"invalid ID operand in module flag (expected metadata string)",
Op->getOperand(1));

View File

@ -0,0 +1,6 @@
; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
!llvm.module.flags = !{!0}
!0 = !{i32 1, null, null}
; CHECK: invalid ID operand in module flag (expected metadata string)