r253190 - [CGDebugInfo] Set the size and align for reference types
Keno Fischer via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 16 01:04:13 PST 2015
Author: kfischer
Date: Mon Nov 16 03:04:13 2015
New Revision: 253190
URL: http://llvm.org/viewvc/llvm-project?rev=253190&view=rev
Log:
[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.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=253190&r1=253189&r2=253190&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Nov 16 03:04:13 2015
@@ -712,10 +712,6 @@ llvm::DIType *CGDebugInfo::CreatePointer
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::CreatePointer
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,
Modified: cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp?rev=253190&r1=253189&r2=253190&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp Mon Nov 16 03:04:13 2015
@@ -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"
More information about the cfe-commits
mailing list