mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Debug Info: Use identifier to reference DIType in base type field of
ptr_to_member. We introduce a new class DITypeRef that represents a reference to a DIType. It wraps around a Value*, which can be either an identifier in MDString or an actual MDNode. The class has a helper function "resolve" that finds the actual MDNode for a given DITypeRef. We specialize getFieldAs to return a field that is a reference to a DIType. To correctly access the base type field of ptr_to_member, getClassType now calls getFieldAs<DITypeRef> to return a DITypeRef. Also add a typedef for DITypeIdentifierMap and a helper generateDITypeIdentifierMap in DebugInfo.h. In DwarfDebug.cpp, we keep a DITypeIdentifierMap and call generateDITypeIdentifierMap to actually populate the map. Verifier is updated accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190081 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -75,6 +75,18 @@ void DIBuilder::finalize() {
|
||||
DIType(TempImportedModules).replaceAllUsesWith(IMs);
|
||||
}
|
||||
|
||||
/// Use the type identifier instead of the actual MDNode if possible,
|
||||
/// to help type uniquing. This function returns the identifier if it
|
||||
/// exists for the given type, otherwise returns the MDNode.
|
||||
static Value *getTypeIdentifier(DIType T) {
|
||||
if (!T.isCompositeType())
|
||||
return T;
|
||||
DICompositeType DTy(T);
|
||||
if (!DTy.getIdentifier())
|
||||
return T;
|
||||
return DTy.getIdentifier();
|
||||
}
|
||||
|
||||
/// getNonCompileUnitScope - If N is compile unit return NULL otherwise return
|
||||
/// N.
|
||||
static MDNode *getNonCompileUnitScope(MDNode *N) {
|
||||
@ -322,7 +334,7 @@ DIDerivedType DIBuilder::createMemberPointerType(DIType PointeeTy,
|
||||
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
|
||||
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
|
||||
PointeeTy,
|
||||
Base
|
||||
getTypeIdentifier(Base)
|
||||
};
|
||||
return DIDerivedType(MDNode::get(VMContext, Elts));
|
||||
}
|
||||
|
Reference in New Issue
Block a user