diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-12-06 02:29:44 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-12-06 02:29:44 +0000 |
commit | 35303fd739705b9167fb2596175e5cb397921566 (patch) | |
tree | 78b922fc24c6d8a6c3ce848fe3914da5346dc9f6 /llvm/lib/AsmParser/LLParser.cpp | |
parent | 6980404cfe7c18ee03369102843ddeaf21e64fcc (diff) | |
download | bcm5719-llvm-35303fd739705b9167fb2596175e5cb397921566.tar.gz bcm5719-llvm-35303fd739705b9167fb2596175e5cb397921566.zip |
IR: Disallow function-local metadata attachments
Metadata attachments to instructions cannot be function-local.
This is part of PR21532.
llvm-svn: 223574
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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; |