DIBuilder: Similar to createPointerType, make createMemberPointerType take
authorAdrian Prantl <aprantl@apple.com>
Tue, 23 Dec 2014 19:11:47 +0000 (19:11 +0000)
committerAdrian Prantl <aprantl@apple.com>
Tue, 23 Dec 2014 19:11:47 +0000 (19:11 +0000)
a size and alignment. Several assertions in DwarfDebug rely on all variable
types to report back a size, or to be derived from a type with a size.

Tested in CFE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224780 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 5482de87d6c43c1ec3d2d20faa710dc05dc0794f..ae1ac650a9ec4b09857cc1ead6e2f87ac92ed06c 100644 (file)
@@ -172,8 +172,12 @@ namespace llvm {
 
     /// \brief Create debugging information entry for a pointer to member.
     /// @param PointeeTy Type pointed to by this pointer.
 
     /// \brief Create debugging information entry for a pointer to member.
     /// @param PointeeTy Type pointed to by this pointer.
+    /// @param SizeInBits  Size.
+    /// @param AlignInBits Alignment. (optional)
     /// @param Class Type for which this pointer points to members of.
     /// @param Class Type for which this pointer points to members of.
-    DIDerivedType createMemberPointerType(DIType PointeeTy, DIType Class);
+    DIDerivedType createMemberPointerType(DIType PointeeTy, DIType Class,
+                                          uint64_t SizeInBits,
+                                          uint64_t AlignInBits = 0);
 
     /// createReferenceType - Create debugging information entry for a c++
     /// style reference or rvalue reference type.
 
     /// createReferenceType - Create debugging information entry for a c++
     /// style reference or rvalue reference type.
index 1874d31e0a56c22527d4bfbbec190525ae6264fb..6485ca5a003984ded30a2924eaa3ebe899ae4811 100644 (file)
@@ -328,14 +328,15 @@ DIBuilder::createPointerType(DIType PointeeTy, uint64_t SizeInBits,
   return DIDerivedType(MDNode::get(VMContext, Elts));
 }
 
   return DIDerivedType(MDNode::get(VMContext, Elts));
 }
 
-DIDerivedType DIBuilder::createMemberPointerType(DIType PointeeTy,
-                                                 DIType Base) {
+DIDerivedType
+DIBuilder::createMemberPointerType(DIType PointeeTy, DIType Base,
+                                   uint64_t SizeInBits, uint64_t AlignInBits) {
   // Pointer types are encoded in DIDerivedType format.
   Metadata *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_ptr_to_member_type)
                           .concat(StringRef())
                           .concat(0) // Line
   // Pointer types are encoded in DIDerivedType format.
   Metadata *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_ptr_to_member_type)
                           .concat(StringRef())
                           .concat(0) // Line
-                          .concat(0) // Size
-                          .concat(0) // Align
+                          .concat(SizeInBits) // Size
+                          .concat(AlignInBits) // Align
                           .concat(0) // Offset
                           .concat(0) // Flags
                           .get(VMContext),
                           .concat(0) // Offset
                           .concat(0) // Flags
                           .get(VMContext),