forked from OSchip/llvm-project
[CGDebugInfo] Set the size and align for reference types
In r253186, I changed the DIBuilder API to now take size and align for reference types as well. This was done in preparation for upcoming changes to the Verifier that will validate that sizes match between DI types and IR values that are declared as having those types. This updates clang to actually pass the information through. llvm-svn: 253190
This commit is contained in:
parent
83709b1c1e
commit
87842f3b4e
|
@ -712,10 +712,6 @@ llvm::DIType *CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag Tag,
|
|||
const Type *Ty,
|
||||
QualType PointeeTy,
|
||||
llvm::DIFile *Unit) {
|
||||
if (Tag == llvm::dwarf::DW_TAG_reference_type ||
|
||||
Tag == llvm::dwarf::DW_TAG_rvalue_reference_type)
|
||||
return DBuilder.createReferenceType(Tag, getOrCreateType(PointeeTy, Unit));
|
||||
|
||||
// Bit size, align and offset of the type.
|
||||
// Size is always the size of a pointer. We can't use getTypeSize here
|
||||
// because that does not return the correct value for references.
|
||||
|
@ -723,8 +719,13 @@ llvm::DIType *CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag Tag,
|
|||
uint64_t Size = CGM.getTarget().getPointerWidth(AS);
|
||||
uint64_t Align = CGM.getContext().getTypeAlign(Ty);
|
||||
|
||||
return DBuilder.createPointerType(getOrCreateType(PointeeTy, Unit), Size,
|
||||
Align);
|
||||
if (Tag == llvm::dwarf::DW_TAG_reference_type ||
|
||||
Tag == llvm::dwarf::DW_TAG_rvalue_reference_type)
|
||||
return DBuilder.createReferenceType(Tag, getOrCreateType(PointeeTy, Unit),
|
||||
Size, Align);
|
||||
else
|
||||
return DBuilder.createPointerType(getOrCreateType(PointeeTy, Unit), Size,
|
||||
Align);
|
||||
}
|
||||
|
||||
llvm::DIType *CGDebugInfo::getOrCreateStructPtrType(StringRef Name,
|
||||
|
|
|
@ -8,5 +8,5 @@ void foo (int &&i)
|
|||
printf("%d\n", i);
|
||||
}
|
||||
|
||||
// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: ![[INT:[0-9]+]])
|
||||
// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: ![[INT:[0-9]+]], size: 64, align: 64)
|
||||
// CHECK: ![[INT]] = !DIBasicType(name: "int"
|
||||
|
|
Loading…
Reference in New Issue