diff options
Diffstat (limited to 'lib/AsmParser/LLParser.cpp')
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index b7b95d7ecf..3c125a01b1 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -2624,6 +2624,23 @@ bool LLParser::ParseBasicBlock(PerFunctionState &PFS) { if (ParseInstruction(Inst, BB, PFS)) return true; + // Parse optional debug info + if (Lex.getKind() == lltok::comma) { + Lex.Lex(); + if (Lex.getKind() == lltok::kw_dbg) { + Lex.Lex(); + if (Lex.getKind() != lltok::Metadata) + return TokError("Expected '!' here"); + Lex.Lex(); + MetadataBase *N = 0; + if (ParseMDNode(N)) return true; + Metadata &TheMetadata = M->getContext().getMetadata(); + unsigned MDDbgKind = TheMetadata.getMDKind("dbg"); + if (!MDDbgKind) + MDDbgKind = TheMetadata.RegisterMDKind("dbg"); + TheMetadata.setMD(MDDbgKind, cast<MDNode>(N), Inst); + } + } BB->getInstList().push_back(Inst); // Set the name on the instruction. |