mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Changed debug info for enums
This commit is contained in:
parent
c7f76f879a
commit
54fa1e0811
4 changed files with 35 additions and 38 deletions
|
@ -2063,13 +2063,6 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDefine)
|
|||
diFieldTypes.push_back(inheritanceType);
|
||||
DbgMakePermanent(diForwardDecl, derivedFrom, diFieldTypes);
|
||||
}
|
||||
else if (isPrimEnum)
|
||||
{
|
||||
BF_ASSERT(type->mSize > 0);
|
||||
|
||||
diForwardDecl = DbgCreateSizedForwardDecl(llvm::dwarf::DW_TAG_enumeration_type,
|
||||
typeName, curDIScope, fileDIScope, 0, (int64)BF_ALIGN(type->mSize, type->mAlign) * 8, (int64)type->mAlign * 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
diForwardDecl = DbgCreateSizedForwardDecl(llvm::dwarf::DW_TAG_structure_type,
|
||||
|
@ -2080,7 +2073,7 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDefine)
|
|||
{
|
||||
// Will fill in later (during definition phase)
|
||||
int flags = 0;
|
||||
diForwardDecl = DbgCreateReplaceableCompositeType(isPrimEnum ? llvm::dwarf::DW_TAG_enumeration_type : llvm::dwarf::DW_TAG_structure_type,
|
||||
diForwardDecl = DbgCreateReplaceableCompositeType(llvm::dwarf::DW_TAG_structure_type,
|
||||
typeName, curDIScope, fileDIScope, 0, (int64)BF_ALIGN(typeInstance->mInstSize, typeInstance->mInstAlign) * 8, (int64)typeInstance->mInstAlign * 8, flags);
|
||||
|
||||
|
||||
|
@ -2140,13 +2133,13 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDefine)
|
|||
void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
||||
{
|
||||
BP_ZONE("BfIRBuilder::CreateDbgTypeDefinition");
|
||||
|
||||
|
||||
auto typeInstance = type->ToTypeInstance();
|
||||
|
||||
bool isPrimEnum = (type->IsEnum()) && (type->IsTypedPrimitive());
|
||||
bool isPrimEnum = (type->IsEnum()) && (type->IsTypedPrimitive());
|
||||
auto typeDef = typeInstance->mTypeDef;
|
||||
bool wantDIData = true;
|
||||
|
||||
|
||||
BfModuleOptions moduleOptions = mModule->GetModuleOptions();
|
||||
bool isOptimized = (moduleOptions.mOptLevel != BfOptLevel_O0) && (moduleOptions.mOptLevel != BfOptLevel_OgPlus);
|
||||
|
||||
|
@ -2549,11 +2542,11 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
|||
if (typeInstance->IsTypedPrimitive())
|
||||
declaredBaseType = typeInstance->GetUnderlyingType();
|
||||
|
||||
if (isPrimEnum)
|
||||
/*if (isPrimEnum)
|
||||
{
|
||||
// Handled below
|
||||
}
|
||||
else if (type->IsBoxed())
|
||||
else*/ if (type->IsBoxed())
|
||||
{
|
||||
auto underlyingType = ((BfBoxedType*)type)->GetModifiedElementType();
|
||||
if (!underlyingType->IsValuelessType())
|
||||
|
@ -2571,15 +2564,9 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
|||
flags, DbgGetType(underlyingType));
|
||||
diFieldTypes.push_back(memberType);
|
||||
}
|
||||
}
|
||||
else if ((typeInstance->IsTypedPrimitive()) && (typeInstance->mBaseType != NULL) && (!typeInstance->mBaseType->IsTypedPrimitive()))
|
||||
{
|
||||
auto underlyingType = typeInstance->GetUnderlyingType();
|
||||
auto inheritanceType = DbgCreateInheritance(diForwardDecl, DbgGetType(underlyingType), 0, llvm::DINode::FlagPublic);
|
||||
diFieldTypes.push_back(inheritanceType);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
auto baseType = typeInstance->mBaseType;
|
||||
|
||||
if (baseType != NULL)
|
||||
|
@ -2592,6 +2579,21 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
|||
inheritanceType = DbgCreateInheritance(diForwardDecl, DbgGetType(baseType), 0, llvm::DINode::FlagPublic);
|
||||
diFieldTypes.push_back(inheritanceType);
|
||||
}
|
||||
|
||||
// Typed primitives are expressed as multiple inheritance
|
||||
if ((typeInstance->IsTypedPrimitive()) && (typeInstance->mBaseType != NULL) && (!typeInstance->mBaseType->IsTypedPrimitive()))
|
||||
{
|
||||
auto underlyingType = typeInstance->GetUnderlyingType();
|
||||
// auto inheritanceType = DbgCreateInheritance(diForwardDecl, DbgGetType(underlyingType), 0, llvm::DINode::FlagPublic);
|
||||
// diFieldTypes.push_back(inheritanceType);
|
||||
|
||||
int lineNum = 0;
|
||||
int flags = llvm::DINode::FlagPublic;
|
||||
auto memberType = DbgCreateMemberType(fileDIScope, "$prim", fileDIScope, lineNum,
|
||||
underlyingType->mSize * 8, underlyingType->mAlign * 8, 0,
|
||||
flags, DbgGetType(underlyingType));
|
||||
diFieldTypes.push_back(memberType);
|
||||
}
|
||||
}
|
||||
|
||||
BfIRMDNode derivedFrom;
|
||||
|
@ -2622,7 +2624,7 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
|||
int diFlags = 0;
|
||||
|
||||
BfIRMDNode diType;
|
||||
if ((typeInstance->IsEnum()) && (typeInstance->IsTypedPrimitive()))
|
||||
/*if ((typeInstance->IsEnum()) && (typeInstance->IsTypedPrimitive()))
|
||||
{
|
||||
llvm::SmallVector<BfIRMDNode, 8> diEnumValues;
|
||||
|
||||
|
@ -2644,7 +2646,7 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
|||
DbgSetType(type, diType);
|
||||
DbgSetInstType(type, diType);
|
||||
}
|
||||
else
|
||||
else*/
|
||||
{
|
||||
BfIRMDNode diCompositeType = DbgMakePermanent(diForwardDecl, BfIRMDNode(), diFieldTypes);
|
||||
diType = diCompositeType;
|
||||
|
|
|
@ -3430,7 +3430,7 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool
|
|||
}
|
||||
|
||||
String findName = identifierNode->ToString();
|
||||
if (findName[0] == '$')
|
||||
if ((findName[0] == '$') && (findName != "$prim"))
|
||||
{
|
||||
if (IsAutoCompleteNode(identifierNode))
|
||||
{
|
||||
|
@ -3484,7 +3484,11 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool
|
|||
if (findName[i] == '$')
|
||||
mayBeRegister = false;
|
||||
if (mayBeRegister)
|
||||
return GetRegister(findName.Substring(1));
|
||||
{
|
||||
DbgTypedValue val = GetRegister(findName.Substring(1));
|
||||
if (val)
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
DbgTypedValue result;
|
||||
|
|
|
@ -999,17 +999,11 @@ bool DbgType::IsValueType()
|
|||
}
|
||||
|
||||
bool DbgType::IsTypedPrimitive()
|
||||
{
|
||||
{
|
||||
if (mTypeCode != DbgType_Struct)
|
||||
return false;
|
||||
auto baseType = GetBaseType();
|
||||
if (baseType == NULL)
|
||||
return false;
|
||||
if (!baseType->IsPrimitiveType() && !baseType->IsTypedPrimitive())
|
||||
return false;
|
||||
if (mTypeParam == NULL)
|
||||
mTypeParam = baseType;
|
||||
return true;
|
||||
|
||||
return mTypeParam != NULL;
|
||||
}
|
||||
|
||||
bool DbgType::IsBoolean()
|
||||
|
@ -5007,9 +5001,6 @@ void DbgModule::CommitHotTargetSections()
|
|||
|
||||
void DbgModule::HotReplaceType(DbgType* newType)
|
||||
{
|
||||
if (!newType->IsCompositeType())
|
||||
return;
|
||||
|
||||
auto linkedModule = GetLinkedModule();
|
||||
|
||||
newType->PopulateType();
|
||||
|
|
|
@ -622,7 +622,7 @@ public:
|
|||
DbgModule* GetDbgModule();
|
||||
DbgType* GetUnderlyingType();
|
||||
DbgType* GetPrimaryType();
|
||||
DbgType* GetBaseType();
|
||||
DbgType* GetBaseType();
|
||||
DbgType* GetRootBaseType();
|
||||
DbgType* RemoveModifiers(bool* hadRef = NULL);
|
||||
String ToStringRaw(DbgLanguage language = DbgLanguage_Unknown);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue