aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-20 22:02:57 +0000
committerDan Gohman <gohman@apple.com>2010-08-20 22:02:57 +0000
commit4cac5b48e379a209d87aa9df191e6bb418e44a0f (patch)
tree10c59d1922e13230c3b17e67b3e3a5401a2b761e /lib/CodeGen/CGDebugInfo.cpp
parenta266ebc09b2b7e097341791b7ffe9d0a09a474a2 (diff)
Introduce a new temporary MDNode concept. Temporary MDNodes are
not part of the IR, are not uniqued, and may be safely RAUW'd. This replaces a variety of alternate mechanisms for achieving the same effect. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111682 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 6c1d321b12..1e287172cf 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -38,7 +38,7 @@ using namespace clang::CodeGen;
CGDebugInfo::CGDebugInfo(CodeGenModule &CGM)
: CGM(CGM), DebugFactory(CGM.getModule()),
- FwdDeclCount(0), BlockLiteralGenericSet(false) {
+ BlockLiteralGenericSet(false) {
CreateCompileUnit();
}
@@ -649,7 +649,7 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
llvm::DISubprogram
CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method,
llvm::DIFile Unit,
- llvm::DICompositeType &RecordTy) {
+ llvm::DIType RecordTy) {
bool IsCtorOrDtor =
isa<CXXConstructorDecl>(Method) || isa<CXXDestructorDecl>(Method);
@@ -708,7 +708,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method,
void CGDebugInfo::
CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DIFile Unit,
llvm::SmallVectorImpl<llvm::DIDescriptor> &EltTys,
- llvm::DICompositeType &RecordTy) {
+ llvm::DIType RecordTy) {
for(CXXRecordDecl::method_iterator I = RD->method_begin(),
E = RD->method_end(); I != E; ++I) {
const CXXMethodDecl *Method = *I;
@@ -726,7 +726,7 @@ CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DIFile Unit,
void CGDebugInfo::
CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile Unit,
llvm::SmallVectorImpl<llvm::DIDescriptor> &EltTys,
- llvm::DICompositeType &RecordTy) {
+ llvm::DIType RecordTy) {
const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
for (CXXRecordDecl::base_class_const_iterator BI = RD->bases_begin(),
@@ -868,12 +868,8 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
// A RD->getName() is not unique. However, the debug info descriptors
// are uniqued so use type name to ensure uniquness.
- llvm::SmallString<128> FwdDeclName;
- llvm::raw_svector_ostream(FwdDeclName) << "fwd.type." << FwdDeclCount++;
- llvm::DICompositeType FwdDecl =
- DebugFactory.CreateCompositeType(Tag, FDContext, FwdDeclName,
- DefUnit, Line, 0, 0, 0, 0,
- llvm::DIType(), llvm::DIArray());
+ llvm::DIType FwdDecl =
+ DebugFactory.CreateTemporaryType(FDContext);
llvm::MDNode *MN = FwdDecl;
llvm::TrackingVH<llvm::MDNode> FwdDeclNode = MN;
@@ -961,7 +957,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
// Now that we have a real decl for the struct, replace anything using the
// old decl with the new one. This will recursively update the debug info.
- llvm::DIDerivedType(FwdDeclNode).replaceAllUsesWith(RealDecl);
+ llvm::DIType(FwdDeclNode).replaceAllUsesWith(RealDecl);
RegionMap[RD] = llvm::WeakVH(RealDecl);
return RealDecl;
}
@@ -990,11 +986,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
// its members. Finally, we create a descriptor for the complete type (which
// may refer to the forward decl if the struct is recursive) and replace all
// uses of the forward declaration with the final definition.
- llvm::DICompositeType FwdDecl =
- DebugFactory.CreateCompositeType(Tag, Unit, ID->getName(),
- DefUnit, Line, 0, 0, 0, 0,
- llvm::DIType(), llvm::DIArray(),
- RuntimeLang);
+ llvm::DIType FwdDecl = DebugFactory.CreateTemporaryType(Unit);
// If this is just a forward declaration, return it.
if (ID->isForwardDecl())
@@ -1093,7 +1085,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
// Now that we have a real decl for the struct, replace anything using the
// old decl with the new one. This will recursively update the debug info.
- llvm::DIDerivedType(FwdDeclNode).replaceAllUsesWith(RealDecl);
+ llvm::DIType(FwdDeclNode).replaceAllUsesWith(RealDecl);
RegionMap[ID] = llvm::WeakVH(RealDecl);
return RealDecl;