[PATCH] D45089: [DebugInfo] Verifier for DILabel.

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


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

Repository:
  rL LLVM

https://reviews.llvm.org/D45089

Files:
  lib/IR/Verifier.cpp


Index: lib/IR/Verifier.cpp
===================================================================
--- lib/IR/Verifier.cpp
+++ lib/IR/Verifier.cpp
@@ -1222,6 +1222,17 @@
            "local variable requires a valid scope", &N, N.getRawScope());
 }
 
+void Verifier::visitDILabel(const DILabel &N) {
+  if (auto *S = N.getRawScope())
+    AssertDI(isa<DIScope>(S), "invalid scope", &N, S);
+  if (auto *F = N.getRawFile())
+    AssertDI(isa<DIFile>(F), "invalid file", &N, F);
+
+  AssertDI(N.getTag() == dwarf::DW_TAG_label, "invalid tag", &N);
+  AssertDI(N.getRawScope() && isa<DILocalScope>(N.getRawScope()),
+           "label requires a valid scope", &N, N.getRawScope());
+}
+
 void Verifier::visitDIExpression(const DIExpression &N) {
   AssertDI(N.isValid(), "invalid expression", &N);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45089.140422.patch
Type: text/x-patch
Size: 793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180330/2455ffb5/attachment.bin>


More information about the llvm-commits mailing list