[PATCH] D45025: [DebugInfo] Add parser for DILabel metadata.

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 06:56:01 PDT 2018


HsiangKai created this revision.
Herald added a subscriber: JDevlieghere.

Define DILabel fields for parsing. Call GET_OR_DISTINCT() to create DILabel
objects and store the objects into LLVMContext.


Repository:
  rL LLVM

https://reviews.llvm.org/D45025

Files:
  lib/AsmParser/LLParser.cpp


Index: lib/AsmParser/LLParser.cpp
===================================================================
--- lib/AsmParser/LLParser.cpp
+++ lib/AsmParser/LLParser.cpp
@@ -4564,6 +4564,23 @@
   return false;
 }
 
+/// ParseDILabel:
+///   ::= !DILabel(scope: !0, name: "foo", file: !1, line: 7)
+///   ::= !DILabel(scope: !0, name: "foo", file: !1, line: 7)
+bool LLParser::ParseDILabel(MDNode *&Result, bool IsDistinct) {
+#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)                                    \
+  REQUIRED(scope, MDField, (/* AllowNull */ false));                           \
+  REQUIRED(name, MDStringField, );                                             \
+  REQUIRED(file, MDField, );                                                   \
+  REQUIRED(line, LineField, );
+  PARSE_MD_FIELDS();
+#undef VISIT_MD_FIELDS
+
+  Result = GET_OR_DISTINCT(DILabel,
+                           (Context, scope.Val, name.Val, file.Val, line.Val));
+  return false;
+}
+
 /// ParseDIExpression:
 ///   ::= !DIExpression(0, 7, -1)
 bool LLParser::ParseDIExpression(MDNode *&Result, bool IsDistinct) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45025.140221.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180329/464ced60/attachment.bin>


More information about the llvm-commits mailing list