[PATCH] D45088: [DebugInfo] Prepare DIBuilder for labels

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 30 06:49:02 PDT 2018


HsiangKai created this revision.
HsiangKai added reviewers: chenwj, rnk.
Herald added a subscriber: JDevlieghere.

Implement createLabel() to allocate DILabel objects.


Repository:
  rL LLVM

https://reviews.llvm.org/D45088

Files:
  include/llvm/IR/DIBuilder.h
  lib/IR/DIBuilder.cpp


Index: lib/IR/DIBuilder.cpp
===================================================================
--- lib/IR/DIBuilder.cpp
+++ lib/IR/DIBuilder.cpp
@@ -699,6 +699,16 @@
                              /* AlignInBits */0);
 }
 
+DILabel *DIBuilder::createLabel(DIScope *Scope, StringRef Name, DIFile *File,
+                                unsigned LineNo) {
+  DIScope *Context = getNonCompileUnitScope(Scope);
+
+  auto *Node =
+      DILabel::get(VMContext, cast_or_null<DILocalScope>(Context), Name,
+                   File, LineNo);
+  return Node;
+}
+
 DIExpression *DIBuilder::createExpression(ArrayRef<uint64_t> Addr) {
   return DIExpression::get(VMContext, Addr);
 }
Index: include/llvm/IR/DIBuilder.h
===================================================================
--- include/llvm/IR/DIBuilder.h
+++ include/llvm/IR/DIBuilder.h
@@ -591,6 +591,13 @@
                        DINode::DIFlags Flags = DINode::FlagZero,
                        uint32_t AlignInBits = 0);
 
+    /// Create a new descriptor for an label.
+    ///
+    /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
+    /// leads to a \a DISubprogram.
+    DILabel *
+    createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo);
+
     /// Create a new descriptor for a parameter variable.
     ///
     /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45088.140421.patch
Type: text/x-patch
Size: 1402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180330/005efde4/attachment.bin>


More information about the llvm-commits mailing list