[PATCH] D76115: Add debug support for set types

peter mckinna via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 22:08:59 PDT 2020


demoitem updated this revision to Diff 259159.
demoitem added a comment.

Added extra Verifier checks to ensure the base type of a set is either an Enumeration or a Base type with integer encoding.
I will extend this check when I land a patch to extend subranges since a set can have a subrange as a basetype.
The llvm-dwarfdump tool outputs set debugging information without any enhancements.
I do not have commit access, so I wonder if someone could commit these changes if acceptable?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76115/new/

https://reviews.llvm.org/D76115

Files:
  llvm/lib/IR/Verifier.cpp


Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -931,6 +931,20 @@
              N.getRawExtraData());
   }
 
+  if (N.getTag() == dwarf::DW_TAG_set_type) {
+    if (auto *T = N.getRawBaseType()) {
+      auto *Enum = dyn_cast_or_null<DICompositeType>(T);
+      auto *Basic = dyn_cast_or_null<DIBasicType>(T);
+      AssertDI((Enum && Enum->getTag() == dwarf::DW_TAG_enumeration_type) ||
+               (Basic && (Basic->getEncoding() == dwarf::DW_ATE_unsigned      ||
+                          Basic->getEncoding() == dwarf::DW_ATE_signed        ||
+                          Basic->getEncoding() == dwarf::DW_ATE_unsigned_char ||
+                          Basic->getEncoding() == dwarf::DW_ATE_signed_char)
+               ),
+               "invalid set base type", &N, T);
+    }
+  }
+
   AssertDI(isScope(N.getRawScope()), "invalid scope", &N, N.getRawScope());
   AssertDI(isType(N.getRawBaseType()), "invalid base type", &N,
            N.getRawBaseType());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76115.259159.patch
Type: text/x-patch
Size: 1082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200422/1c65b004/attachment.bin>


More information about the llvm-commits mailing list