diff options
author | Amjad Aboud <amjad.aboud@intel.com> | 2016-12-25 10:12:09 +0000 |
---|---|---|
committer | Amjad Aboud <amjad.aboud@intel.com> | 2016-12-25 10:12:09 +0000 |
commit | 7faeecc8f78c31c24c32a9c2e468e840e1b0a15d (patch) | |
tree | 070d7be17f00e414ff58b6f2b3b8517d3d2341bb /llvm/lib/AsmParser | |
parent | 5dc0bba4e4a76a338dd34ef6eee695e8446e9236 (diff) | |
download | bcm5719-llvm-7faeecc8f78c31c24c32a9c2e468e840e1b0a15d.tar.gz bcm5719-llvm-7faeecc8f78c31c24c32a9c2e468e840e1b0a15d.zip |
[DebugInfo] Added support for Checksum debug info feature.
Differential Revision: https://reviews.llvm.org/D27642
llvm-svn: 290514
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r-- | llvm/lib/AsmParser/LLLexer.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 30 | ||||
-rw-r--r-- | llvm/lib/AsmParser/LLToken.h | 1 |
3 files changed, 34 insertions, 3 deletions
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index bed5306cc07..752942fc9fc 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -808,6 +808,12 @@ lltok::Kind LLLexer::LexIdentifier() { StrVal.assign(Keyword.begin(), Keyword.end()); return lltok::DIFlag; } + + if (Keyword.startswith("CSK_")) { + StrVal.assign(Keyword.begin(), Keyword.end()); + return lltok::ChecksumKind; + } + if (Keyword == "NoDebug" || Keyword == "FullDebug" || Keyword == "LineTablesOnly") { StrVal.assign(Keyword.begin(), Keyword.end()); diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index d2e2c0d46d3..8e86b483664 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -3465,6 +3465,11 @@ struct MDFieldList : public MDFieldImpl<SmallVector<Metadata *, 4>> { MDFieldList() : ImplTy(SmallVector<Metadata *, 4>()) {} }; +struct ChecksumKindField : public MDFieldImpl<DIFile::ChecksumKind> { + ChecksumKindField() : ImplTy(DIFile::CSK_None) {} + ChecksumKindField(DIFile::ChecksumKind CSKind) : ImplTy(CSKind) {} +}; + } // end anonymous namespace namespace llvm { @@ -3742,6 +3747,20 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name, MDFieldList &Result) { return false; } +template <> +bool LLParser::ParseMDField(LocTy Loc, StringRef Name, + ChecksumKindField &Result) { + if (Lex.getKind() != lltok::ChecksumKind) + return TokError( + "invalid checksum kind" + Twine(" '") + Lex.getStrVal() + "'"); + + DIFile::ChecksumKind CSKind = DIFile::getChecksumKind(Lex.getStrVal()); + + Result.assign(CSKind); + Lex.Lex(); + return false; +} + } // end namespace llvm template <class ParserTy> @@ -3971,15 +3990,20 @@ bool LLParser::ParseDISubroutineType(MDNode *&Result, bool IsDistinct) { } /// ParseDIFileType: -/// ::= !DIFileType(filename: "path/to/file", directory: "/path/to/dir") +/// ::= !DIFileType(filename: "path/to/file", directory: "/path/to/dir" +/// checksumkind: CSK_MD5, +/// checksum: "000102030405060708090a0b0c0d0e0f") bool LLParser::ParseDIFile(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ REQUIRED(filename, MDStringField, ); \ - REQUIRED(directory, MDStringField, ); + REQUIRED(directory, MDStringField, ); \ + OPTIONAL(checksumkind, ChecksumKindField, ); \ + OPTIONAL(checksum, MDStringField, ); PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - Result = GET_OR_DISTINCT(DIFile, (Context, filename.Val, directory.Val)); + Result = GET_OR_DISTINCT(DIFile, (Context, filename.Val, directory.Val, + checksumkind.Val, checksum.Val)); return false; } diff --git a/llvm/lib/AsmParser/LLToken.h b/llvm/lib/AsmParser/LLToken.h index a1695258bbe..048aeee90b3 100644 --- a/llvm/lib/AsmParser/LLToken.h +++ b/llvm/lib/AsmParser/LLToken.h @@ -353,6 +353,7 @@ enum Kind { DwarfOp, // DW_OP_foo DIFlag, // DIFlagFoo DwarfMacinfo, // DW_MACINFO_foo + ChecksumKind, // CSK_foo // Type valued tokens (TyVal). Type, |