summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-06-01 01:17:57 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-06-01 01:17:57 +0000
commit382d81cacf066452b98128b680f0988e5bda89a8 (patch)
tree1d50935b001bb7b52b70a6a9d87e0b3139b82292 /llvm/lib/IR/Verifier.cpp
parent09ec5756dc7d92c3a2f91313736c157bf3ffd848 (diff)
downloadbcm5719-llvm-382d81cacf066452b98128b680f0988e5bda89a8.tar.gz
bcm5719-llvm-382d81cacf066452b98128b680f0988e5bda89a8.zip
IR: Allow multiple global metadata attachments with the same type.
This will be necessary to allow the global merge pass to attach multiple debug info metadata nodes to global variables once we reverse the edge from DIGlobalVariable to GlobalVariable. Differential Revision: http://reviews.llvm.org/D20414 llvm-svn: 271358
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index c47bb2518e0..fbf73509403 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1991,6 +1991,7 @@ void Verifier::visitFunction(const Function &F) {
"blockaddress may not be used with the entry block!", Entry);
}
+ unsigned NumDebugAttachments = 0;
// Visit metadata attachments.
for (const auto &I : MDs) {
// Verify that the attachment is legal.
@@ -1998,6 +1999,9 @@ void Verifier::visitFunction(const Function &F) {
default:
break;
case LLVMContext::MD_dbg:
+ ++NumDebugAttachments;
+ AssertDI(NumDebugAttachments == 1,
+ "function must have a single !dbg attachment", &F, I.second);
AssertDI(isa<DISubprogram>(I.second),
"function !dbg attachment must be a subprogram", &F, I.second);
break;
OpenPOWER on IntegriCloud