Remove the type retaining from the clang frontend. This is now

handled by the caching and rauw. Also fix one cache that wasn't
being added to highlighted by this patch. Update all testcases
accordingly.

This should fix the deall failure.

llvm-svn: 150977
This commit is contained in:
Eric Christopher 2012-02-20 18:05:24 +00:00
parent e908a7a92c
commit 66562a4a54
4 changed files with 14 additions and 11 deletions

View File

@ -551,7 +551,9 @@ llvm::DIType CGDebugInfo::CreatePointeeType(QualType PointeeTy,
RecordDecl *RD = RTy->getDecl();
llvm::DIDescriptor FDContext =
getContextDescriptor(cast<Decl>(RD->getDeclContext()));
return createRecordFwdDecl(RD, FDContext);
llvm::DIType RetTy = createRecordFwdDecl(RD, FDContext);
TypeCache[QualType(RTy, 0).getAsOpaquePtr()] = RetTy;
return RetTy;
}
return getOrCreateType(PointeeTy, Unit);
@ -1118,7 +1120,6 @@ CollectVTableInfo(const CXXRecordDecl *RD, llvm::DIFile Unit,
llvm::DIType CGDebugInfo::getOrCreateRecordType(QualType RTy,
SourceLocation Loc) {
llvm::DIType T = getOrCreateType(RTy, getOrCreateFile(Loc));
DBuilder.retainType(T);
return T;
}
@ -1767,7 +1768,7 @@ llvm::DIType CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
// than C++ class type, but needs llvm metadata changes first.
RealDecl = DBuilder.createClassType(RDContext, RDName, DefUnit, Line,
Size, Align, 0, 0, llvm::DIType(),
llvm::DIArray(), NULL,
llvm::DIArray(), llvm::DIType(),
llvm::DIArray());
} else
RealDecl = DBuilder.createStructType(RDContext, RDName, DefUnit, Line,
@ -2577,8 +2578,9 @@ void CGDebugInfo::finalize(void) {
RepTy = llvm::DIType(cast<llvm::MDNode>(it->second));
}
if (Ty.Verify() && RepTy.Verify())
if (Ty.Verify() && Ty.isForwardDecl() && RepTy.Verify()) {
Ty.replaceAllUsesWith(RepTy);
}
}
DBuilder.finalize();
}

View File

@ -23,7 +23,8 @@ int main(int argc, char **argv) {
}
// FIXME: The numbers are truly awful.
// CHECK: !22 = metadata !{i32 786447, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !5} ; [ DW_TAG_pointer_type ]
// CHECK: metadata !5, metadata !"A", metadata !"A", metadata !"", metadata !6, i32 12, metadata !34, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 false, null, null, i32 0, metadata !36} ; [ DW_TAG_subprogram ]
// CHECK: metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !35, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
// CHECK: !35 = metadata !{null, metadata !30, metadata !13, metadata !22}
// CHECK: !18 = metadata !{i32 786447, i32 0, metadata !"", i32 0, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !19} ; [ DW_TAG_pointer_type ]
// CHECK: !19 = metadata !{i32 786434, null, metadata !"A", metadata !6, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !20, i32 0, metadata !19, null} ; [ DW_TAG_class_type ]
// CHECK: metadata !19, metadata !"A", metadata !"A", metadata !"", metadata !6, i32 12, metadata !45, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 false, null, null, i32 0, metadata !47} ; [ DW_TAG_subprogram ]
// CHECK: metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !46, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
// CHECK: !46 = metadata !{null, metadata !18, metadata !9, metadata !34}

View File

@ -19,8 +19,8 @@ int main(int argc, char** argv) {
// Make sure we have two DW_TAG_class_types for baz and bar and no forward
// references.
// FIXME: These should be struct types to match the declaration.
// CHECK: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !7, i32 0, null, null} ; [ DW_TAG_class_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 32, i64 32, i32 0, i32 0, null, metadata !10, i32 0, null, null} ; [ DW_TAG_class_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !20, i32 0, null, null} ; [ DW_TAG_class_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 32, i64 32, i32 0, i32 0, null, metadata !23, i32 0, null, null} ; [ DW_TAG_class_type ]
// CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 9, i64 0, i64 0, i32 0, i32 4, i32 0, null, i32 0, i32 0} ; [ DW_TAG_class_type ]
// CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 0, i64 0, i32 0, i32 4, null, null, i32 0, null, null} ; [ DW_TAG_class_type ]

View File

@ -2,4 +2,4 @@
@class ForwardObjcClass;
ForwardObjcClass *ptr = 0;
// CHECK: metadata !{i32 {{.*}}, metadata !{{.*}}, metadata !"ForwardObjcClass", metadata !{{.*}}, i32 2, i64 0, i64 0, i32 0, i32 4, null, null, i32 16, i32 0} ; [ DW_TAG_structure_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"ForwardObjcClass", metadata !6, i32 2, i32 0, i32 0, i32 0, i32 4, null, null, i32 16} ; [ DW_TAG_structure_type ]