Skip to content
Snippets Groups Projects
Commit ba4ad7f2 authored by Devang Patel's avatar Devang Patel
Browse files

Avoid use of DIDescriptor::getNode(). Use overloaded operators instead.

llvm-svn: 103273
parent cfa8e9d4
No related branches found
No related tags found
No related merge requests found
...@@ -114,7 +114,7 @@ llvm::DIFile CGDebugInfo::getOrCreateFile(SourceLocation Loc) { ...@@ -114,7 +114,7 @@ llvm::DIFile CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
llvm::DIFile F = DebugFactory.CreateFile(AbsFileName.getLast(), llvm::DIFile F = DebugFactory.CreateFile(AbsFileName.getLast(),
AbsFileName.getDirname(), TheCU); AbsFileName.getDirname(), TheCU);
DIFileCache[fname] = F.getNode(); DIFileCache[fname] = F;
return F; return F;
} }
...@@ -506,7 +506,7 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method, ...@@ -506,7 +506,7 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
// Add "this" pointer. // Add "this" pointer.
llvm::DIArray Args = llvm::DICompositeType(FnTy.getNode()).getTypeArray(); llvm::DIArray Args = llvm::DICompositeType(FnTy).getTypeArray();
assert (Args.getNumElements() && "Invalid number of arguments!"); assert (Args.getNumElements() && "Invalid number of arguments!");
llvm::SmallVector<llvm::DIDescriptor, 16> Elts; llvm::SmallVector<llvm::DIDescriptor, 16> Elts;
...@@ -520,7 +520,7 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method, ...@@ -520,7 +520,7 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
Context.getPointerType(Context.getTagDeclType(Method->getParent())); Context.getPointerType(Context.getTagDeclType(Method->getParent()));
llvm::DIType ThisPtrType = llvm::DIType ThisPtrType =
DebugFactory.CreateArtificialType(getOrCreateType(ThisPtr, Unit)); DebugFactory.CreateArtificialType(getOrCreateType(ThisPtr, Unit));
TypeCache[ThisPtr.getAsOpaquePtr()] = ThisPtrType.getNode(); TypeCache[ThisPtr.getAsOpaquePtr()] = ThisPtrType;
Elts.push_back(ThisPtrType); Elts.push_back(ThisPtrType);
// Copy rest of the arguments. // Copy rest of the arguments.
...@@ -597,7 +597,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, ...@@ -597,7 +597,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method,
// Don't cache ctors or dtors since we have to emit multiple functions for // Don't cache ctors or dtors since we have to emit multiple functions for
// a single ctor or dtor. // a single ctor or dtor.
if (!IsCtorOrDtor && Method->isThisDeclarationADefinition()) if (!IsCtorOrDtor && Method->isThisDeclarationADefinition())
SPCache[Method] = llvm::WeakVH(SP.getNode()); SPCache[Method] = llvm::WeakVH(SP);
return SP; return SP;
} }
...@@ -774,13 +774,14 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, ...@@ -774,13 +774,14 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
if (!RD->getDefinition()) if (!RD->getDefinition())
return FwdDecl; return FwdDecl;
llvm::TrackingVH<llvm::MDNode> FwdDeclNode = FwdDecl.getNode(); llvm::MDNode *MN = FwdDecl;
llvm::TrackingVH<llvm::MDNode> FwdDeclNode = MN;
// Otherwise, insert it into the TypeCache so that recursive uses will find // Otherwise, insert it into the TypeCache so that recursive uses will find
// it. // it.
TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl.getNode(); TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl;
// Push the struct on region stack. // Push the struct on region stack.
RegionStack.push_back(FwdDecl.getNode()); RegionStack.push_back(FwdDeclNode);
RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl.getNode()); RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl);
// Convert all the elements. // Convert all the elements.
llvm::SmallVector<llvm::DIDescriptor, 16> EltTys; llvm::SmallVector<llvm::DIDescriptor, 16> EltTys;
...@@ -799,9 +800,9 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, ...@@ -799,9 +800,9 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD); const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
if (const CXXRecordDecl *PBase = RL.getPrimaryBase()) if (const CXXRecordDecl *PBase = RL.getPrimaryBase())
ContainingType = ContainingType =
getOrCreateType(QualType(PBase->getTypeForDecl(), 0), Unit).getNode(); getOrCreateType(QualType(PBase->getTypeForDecl(), 0), Unit);
else if (CXXDecl->isDynamicClass()) else if (CXXDecl->isDynamicClass())
ContainingType = FwdDecl.getNode(); ContainingType = FwdDecl;
} }
llvm::DIArray Elements = llvm::DIArray Elements =
...@@ -829,7 +830,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, ...@@ -829,7 +830,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
// Now that we have a real decl for the struct, replace anything using the // 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. // old decl with the new one. This will recursively update the debug info.
llvm::DIDerivedType(FwdDeclNode).replaceAllUsesWith(RealDecl); llvm::DIDerivedType(FwdDeclNode).replaceAllUsesWith(RealDecl);
RegionMap[RD] = llvm::WeakVH(RealDecl.getNode()); RegionMap[RD] = llvm::WeakVH(RealDecl);
return RealDecl; return RealDecl;
} }
...@@ -865,13 +866,14 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, ...@@ -865,13 +866,14 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
if (ID->isForwardDecl()) if (ID->isForwardDecl())
return FwdDecl; return FwdDecl;
llvm::TrackingVH<llvm::MDNode> FwdDeclNode = FwdDecl.getNode(); llvm::MDNode *MN = FwdDecl;
llvm::TrackingVH<llvm::MDNode> FwdDeclNode = MN;
// Otherwise, insert it into the TypeCache so that recursive uses will find // Otherwise, insert it into the TypeCache so that recursive uses will find
// it. // it.
TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl.getNode(); TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl;
// Push the struct on region stack. // Push the struct on region stack.
RegionStack.push_back(FwdDecl.getNode()); RegionStack.push_back(FwdDeclNode);
RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl.getNode()); RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl);
// Convert all the elements. // Convert all the elements.
llvm::SmallVector<llvm::DIDescriptor, 16> EltTys; llvm::SmallVector<llvm::DIDescriptor, 16> EltTys;
...@@ -962,7 +964,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, ...@@ -962,7 +964,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
// Now that we have a real decl for the struct, replace anything using the // 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. // old decl with the new one. This will recursively update the debug info.
llvm::DIDerivedType(FwdDeclNode).replaceAllUsesWith(RealDecl); llvm::DIDerivedType(FwdDeclNode).replaceAllUsesWith(RealDecl);
RegionMap[ID] = llvm::WeakVH(RealDecl.getNode()); RegionMap[ID] = llvm::WeakVH(RealDecl);
return RealDecl; return RealDecl;
} }
...@@ -1194,7 +1196,7 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty, ...@@ -1194,7 +1196,7 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
llvm::DIType Res = CreateTypeNode(Ty, Unit); llvm::DIType Res = CreateTypeNode(Ty, Unit);
// And update the type cache. // And update the type cache.
TypeCache[Ty.getAsOpaquePtr()] = Res.getNode(); TypeCache[Ty.getAsOpaquePtr()] = Res;
return Res; return Res;
} }
...@@ -1304,9 +1306,10 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, ...@@ -1304,9 +1306,10 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType,
FI = SPCache.find(FD); FI = SPCache.find(FD);
if (FI != SPCache.end()) { if (FI != SPCache.end()) {
llvm::DIDescriptor SP(dyn_cast_or_null<llvm::MDNode>(FI->second)); llvm::DIDescriptor SP(dyn_cast_or_null<llvm::MDNode>(FI->second));
if (SP.isSubprogram() && llvm::DISubprogram(SP.getNode()).isDefinition()) { if (SP.isSubprogram() && llvm::DISubprogram(SP).isDefinition()) {
RegionStack.push_back(SP.getNode()); llvm::MDNode *SPN = SP;
RegionMap[D] = llvm::WeakVH(SP.getNode()); RegionStack.push_back(SPN);
RegionMap[D] = llvm::WeakVH(SP);
return; return;
} }
} }
...@@ -1334,8 +1337,9 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, ...@@ -1334,8 +1337,9 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType,
Fn->hasInternalLinkage(), true/*definition*/); Fn->hasInternalLinkage(), true/*definition*/);
// Push function on region stack. // Push function on region stack.
RegionStack.push_back(SP.getNode()); llvm::MDNode *SPN = SP;
RegionMap[D] = llvm::WeakVH(SP.getNode()); RegionStack.push_back(SPN);
RegionMap[D] = llvm::WeakVH(SP);
} }
...@@ -1375,7 +1379,8 @@ void CGDebugInfo::EmitRegionStart(llvm::Function *Fn, CGBuilderTy &Builder) { ...@@ -1375,7 +1379,8 @@ void CGDebugInfo::EmitRegionStart(llvm::Function *Fn, CGBuilderTy &Builder) {
llvm::DIDescriptor() : llvm::DIDescriptor() :
llvm::DIDescriptor(RegionStack.back()), llvm::DIDescriptor(RegionStack.back()),
PLoc.getLine(), PLoc.getColumn()); PLoc.getLine(), PLoc.getColumn());
RegionStack.push_back(D.getNode()); llvm::MDNode *DN = D;
RegionStack.push_back(DN);
} }
/// EmitRegionEnd - Constructs the debug code for exiting a declarative /// EmitRegionEnd - Constructs the debug code for exiting a declarative
...@@ -1662,7 +1667,7 @@ CGDebugInfo::getOrCreateNameSpace(const NamespaceDecl *NSDecl, ...@@ -1662,7 +1667,7 @@ CGDebugInfo::getOrCreateNameSpace(const NamespaceDecl *NSDecl,
getContextDescriptor(dyn_cast<Decl>(NSDecl->getDeclContext()), Unit); getContextDescriptor(dyn_cast<Decl>(NSDecl->getDeclContext()), Unit);
llvm::DINameSpace NS = llvm::DINameSpace NS =
DebugFactory.CreateNameSpace(Context, NSDecl->getName(), DebugFactory.CreateNameSpace(Context, NSDecl->getName(),
llvm::DIFile(Unit.getNode()), LineNo); llvm::DIFile(Unit), LineNo);
NameSpaceCache[NSDecl] = llvm::WeakVH(NS.getNode()); NameSpaceCache[NSDecl] = llvm::WeakVH(NS);
return NS; return NS;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment