diff options
author | Devang Patel <dpatel@apple.com> | 2009-09-16 18:18:06 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-09-16 18:18:06 +0000 |
commit | cea188aa5f5325947ecd85414bd1d5477c14e21a (patch) | |
tree | ec0478650c6a0cf5e1f23c0a42c3f8957ae2308c /lib/AsmParser/LLParser.cpp | |
parent | 95c1984e6b0b299f74d8a428fac6b6be266ae169 (diff) |
Parse debug info attached with an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82063 91177308-0d34-0410-b5e6-96231b3b80d8
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. |