From 382d81cacf066452b98128b680f0988e5bda89a8 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 1 Jun 2016 01:17:57 +0000 Subject: 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 --- llvm/lib/IR/Verifier.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/IR/Verifier.cpp') 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(I.second), "function !dbg attachment must be a subprogram", &F, I.second); break; -- cgit v1.2.3