[PATCH] D21766: [codeview][clang] Added support for unnamed bitfield type.

Amjad Aboud via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 27 12:02:40 PDT 2016


aaboud created this revision.
aaboud added reviewers: rnk, majnemer.
aaboud added subscribers: cfe-commits, bwyma.

Allow creating DI metadata for non-zero width unnamed bitfield members when emitting CodeView.
This is needed for patch D21489.

http://reviews.llvm.org/D21766

Files:
  lib/CodeGen/CGDebugInfo.cpp

Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1010,14 +1010,20 @@
     const RecordDecl *RD) {
   StringRef name = field->getName();
   QualType type = field->getType();
+  bool EmitCodeView = CGM.getCodeGenOpts().EmitCodeView;
 
   // Ignore unnamed fields unless they're anonymous structs/unions.
   if (name.empty() && !type->isRecordType())
-    return;
+    // Do not ignore anonymous bitfield when emitting CodeView.
+    if(!EmitCodeView || !field->isBitField())
+      return;
 
   uint64_t SizeInBitsOverride = 0;
   if (field->isBitField()) {
     SizeInBitsOverride = field->getBitWidthValue(CGM.getContext());
+    if (!SizeInBitsOverride && name.empty())
+      // Ignore unnamed 0-width bitfield.
+      return;
     assert(SizeInBitsOverride && "found named 0-width bitfield");
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21766.61999.patch
Type: text/x-patch
Size: 946 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160627/98150460/attachment-0001.bin>


More information about the cfe-commits mailing list