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 | 7464a698dfc9a4b4a42a303e71eb327768288463 (patch) | |
tree | ec0478650c6a0cf5e1f23c0a42c3f8957ae2308c | |
parent | 9514eca3ca9a35a0f5fc01763f6556bec579cc0e (diff) | |
download | external_llvm-7464a698dfc9a4b4a42a303e71eb327768288463.zip external_llvm-7464a698dfc9a4b4a42a303e71eb327768288463.tar.gz external_llvm-7464a698dfc9a4b4a42a303e71eb327768288463.tar.bz2 |
Parse debug info attached with an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82063 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AsmParser/LLLexer.cpp | 1 | ||||
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 17 | ||||
-rw-r--r-- | lib/AsmParser/LLToken.h | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index 23d7f19..315048c 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -530,6 +530,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(asm); KEYWORD(sideeffect); KEYWORD(gc); + KEYWORD(dbg); KEYWORD(ccc); KEYWORD(fastcc); diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index b7b95d7..3c125a0 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. diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h index b053cca..dd6359a 100644 --- a/lib/AsmParser/LLToken.h +++ b/lib/AsmParser/LLToken.h @@ -63,6 +63,7 @@ namespace lltok { kw_asm, kw_sideeffect, kw_gc, + kw_dbg, kw_c, kw_cc, kw_ccc, kw_fastcc, kw_coldcc, |