From 35303fd739705b9167fb2596175e5cb397921566 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Sat, 6 Dec 2014 02:29:44 +0000 Subject: IR: Disallow function-local metadata attachments Metadata attachments to instructions cannot be function-local. This is part of PR21532. llvm-svn: 223574 --- llvm/lib/AsmParser/LLParser.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/AsmParser/LLParser.cpp') diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 93eb490619f..f44af673fcd 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -62,6 +62,8 @@ bool LLParser::ValidateEndOfModule() { NumberedMetadata[SlotNo] == nullptr) return Error(MDList[i].Loc, "use of undefined metadata '!" + Twine(SlotNo) + "'"); + assert(!NumberedMetadata[SlotNo]->isFunctionLocal() && + "Unexpected function-local metadata"); Inst->setMetadata(MDList[i].MDKind, NumberedMetadata[SlotNo]); } } @@ -1529,6 +1531,8 @@ bool LLParser::ParseInstructionMetadata(Instruction *Inst, if (ParseMetadataListValue(ID, PFS)) return true; assert(ID.Kind == ValID::t_MDNode); + if (ID.MDNodeVal->isFunctionLocal()) + return TokError("unexpected function-local metadata"); Inst->setMetadata(MDK, ID.MDNodeVal); } else { unsigned NodeID = 0; -- cgit v1.2.3