mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Fixed enums in debugger, reformatting of operator constraints
This commit is contained in:
parent
533ef0856b
commit
7b8251c311
11 changed files with 65 additions and 22 deletions
|
@ -2168,6 +2168,9 @@ void BeIRCodeGen::HandleNextCmd()
|
|||
func->mIsDLLExport = true;
|
||||
else if (attribute == BFIRAttribute_DllImport)
|
||||
func->mIsDLLImport = true;
|
||||
else if (attribute == BFIRAttribute_NoRecurse)
|
||||
{
|
||||
}
|
||||
else
|
||||
BF_FATAL("Unhandled");
|
||||
}
|
||||
|
|
|
@ -17981,3 +17981,4 @@ void BfExprEvaluator::Visit(BfBinaryOperatorExpression* binOpExpr)
|
|||
|
||||
PerformBinaryOperation(binOpExpr->mLeft, binOpExpr->mRight, binOpExpr->mOp, binOpExpr->mOpToken, BfBinOpFlag_None);
|
||||
}
|
||||
//
|
|
@ -593,6 +593,7 @@ enum BfIRAttribute
|
|||
BFIRAttribute_NoFramePointerElim,
|
||||
BFIRAttribute_DllImport,
|
||||
BFIRAttribute_DllExport,
|
||||
BFIRAttribute_NoRecurse
|
||||
};
|
||||
|
||||
struct BfIRFunctionType
|
||||
|
|
|
@ -201,6 +201,7 @@ static llvm::Attribute::AttrKind LLVMMapAttribute(BfIRAttribute attr)
|
|||
case BFIRAttribute_NoUnwind: return llvm::Attribute::NoUnwind;
|
||||
case BFIRAttribute_UWTable: return llvm::Attribute::UWTable;
|
||||
case BFIRAttribute_AlwaysInline: return llvm::Attribute::AlwaysInline;
|
||||
case BFIRAttribute_NoRecurse: return llvm::Attribute::NoRecurse;
|
||||
default: break;
|
||||
}
|
||||
return llvm::Attribute::None;
|
||||
|
|
|
@ -13877,7 +13877,9 @@ void BfModule::SetupIRMethod(BfMethodInstance* methodInstance, BfIRFunction func
|
|||
mBfIRBuilder->SetFuncCallingConv(func, callingConv);
|
||||
|
||||
if (isInlined)
|
||||
{
|
||||
mBfIRBuilder->Func_AddAttribute(func, -1, BFIRAttribute_AlwaysInline);
|
||||
}
|
||||
|
||||
int argIdx = 0;
|
||||
int paramIdx = 0;
|
||||
|
|
|
@ -7895,7 +7895,7 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
|
|||
}
|
||||
|
||||
// * -> Valueless
|
||||
if (toType->IsValuelessType())
|
||||
if (toType->IsVoid())
|
||||
return mBfIRBuilder->GetFakeVal();
|
||||
|
||||
// void* -> intptr
|
||||
|
@ -9284,10 +9284,10 @@ BfTypedValue BfModule::Cast(BfAstNode* srcNode, const BfTypedValue& typedVal, Bf
|
|||
}
|
||||
}
|
||||
|
||||
if ((explicitCast) && (toType->IsValuelessType()))
|
||||
/*if ((explicitCast) && (toType->IsValuelessType()))
|
||||
{
|
||||
return BfTypedValue(mBfIRBuilder->GetFakeVal(), toType);
|
||||
}
|
||||
}*/
|
||||
|
||||
BfCastResultFlags castResultFlags = BfCastResultFlags_None;
|
||||
auto castedValue = CastToValue(srcNode, typedVal, toType, castFlags, &castResultFlags);
|
||||
|
|
|
@ -742,6 +742,19 @@ void BfPrinter::Visit(BfGenericParamsDeclaration* genericParams)
|
|||
VisitChild(genericParams->mCloseChevron);
|
||||
}
|
||||
|
||||
void BfPrinter::Visit(BfGenericOperatorConstraint* genericConstraints)
|
||||
{
|
||||
Visit(genericConstraints->ToBase());
|
||||
|
||||
VisitChild(genericConstraints->mOperatorToken);
|
||||
ExpectSpace();
|
||||
VisitChild(genericConstraints->mLeftType);
|
||||
ExpectSpace();
|
||||
VisitChild(genericConstraints->mOpToken);
|
||||
ExpectSpace();
|
||||
VisitChild(genericConstraints->mRightType);
|
||||
}
|
||||
|
||||
void BfPrinter::Visit(BfGenericConstraintsDeclaration* genericConstraints)
|
||||
{
|
||||
Visit(genericConstraints->ToBase());
|
||||
|
@ -1946,6 +1959,12 @@ void BfPrinter::QueueMethodDeclaration(BfMethodDeclaration* methodDeclaration)
|
|||
QueueVisitChild(methodDeclaration->mExplicitInterface);
|
||||
QueueVisitChild(methodDeclaration->mExplicitInterfaceDotToken);
|
||||
QueueVisitChild(methodDeclaration->mNameNode);
|
||||
|
||||
if (auto operatorDecl = BfNodeDynCast<BfOperatorDeclaration>(methodDeclaration))
|
||||
{
|
||||
if ((operatorDecl->mOpTypeToken != NULL) && (operatorDecl->mOpTypeToken->mToken == BfToken_LChevron))
|
||||
ExpectSpace();
|
||||
}
|
||||
QueueVisitChild(methodDeclaration->mGenericParams);
|
||||
|
||||
if (auto operatorDecl = BfNodeDynCast<BfOperatorDeclaration>(methodDeclaration))
|
||||
|
@ -1954,7 +1973,6 @@ void BfPrinter::QueueMethodDeclaration(BfMethodDeclaration* methodDeclaration)
|
|||
QueueVisitChild(operatorDecl->mExplicitToken);
|
||||
ExpectSpace();
|
||||
QueueVisitChild(operatorDecl->mOperatorToken);
|
||||
ExpectSpace();
|
||||
QueueVisitChild(operatorDecl->mOpTypeToken);
|
||||
ExpectSpace();
|
||||
QueueVisitChild(methodDeclaration->mReturnType);
|
||||
|
|
|
@ -113,6 +113,7 @@ public:
|
|||
|
||||
virtual void Visit(BfAttributeDirective* attributeDirective) override;
|
||||
virtual void Visit(BfGenericParamsDeclaration* genericParams) override;
|
||||
virtual void Visit(BfGenericOperatorConstraint* genericConstraints) override;
|
||||
virtual void Visit(BfGenericConstraintsDeclaration* genericConstraints) override;
|
||||
virtual void Visit(BfGenericArgumentsNode* genericArgumentsNode) override;
|
||||
|
||||
|
|
|
@ -904,6 +904,24 @@ const String& DbgSrcFile::GetLocalPath()
|
|||
return (!mLocalPath.IsEmpty()) ? mLocalPath : mFilePath;
|
||||
}
|
||||
|
||||
void DbgSrcFile::GetHash(String& outStr)
|
||||
{
|
||||
if (mHashKind == DbgHashKind_MD5)
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
outStr += StrFormat("%02X", mHash[i]);
|
||||
}
|
||||
}
|
||||
else if (mHashKind == DbgHashKind_SHA256)
|
||||
{
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
outStr += StrFormat("%02X", mHash[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DbgType::DbgType()
|
||||
|
@ -1394,6 +1412,7 @@ DbgType* DbgType::GetPrimaryType()
|
|||
((mCompileUnit->mLanguage == DbgLanguage_Beef) || (mTypeCode == DbgType_Namespace) || (mIsDeclaration)))
|
||||
{
|
||||
mPrimaryType = mCompileUnit->mDbgModule->GetPrimaryType(this);
|
||||
mTypeCode = mPrimaryType->mTypeCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -760,6 +760,7 @@ public:
|
|||
void RemoveLines(DbgModule* debugModule, DbgSubprogram* dbgSubprogram, bool isHotReplaced);
|
||||
void RehupLineData();
|
||||
const String& GetLocalPath();
|
||||
void GetHash(String& hashStr);
|
||||
};
|
||||
|
||||
class DwCommonFrameDescriptor
|
||||
|
|
|
@ -6433,6 +6433,8 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
|
|||
|
||||
if (dwValueType == NULL)
|
||||
dwValueType = dbgModule->GetPrimitiveType(DbgType_Void, language);
|
||||
else
|
||||
dwValueType = dwValueType->GetPrimaryType();
|
||||
|
||||
if (dwValueType->mTypeCode == DbgType_TypeDef)
|
||||
{
|
||||
|
@ -10683,20 +10685,7 @@ String WinDebugger::GetStackFrameInfo(int stackFrameIdx, intptr* addr, String* o
|
|||
if (srcFile->mHashKind != DbgHashKind_None)
|
||||
{
|
||||
outStr += "#";
|
||||
if (srcFile->mHashKind == DbgHashKind_MD5)
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
outStr += StrFormat("%02X", srcFile->mHash[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
outStr += StrFormat("%02X", srcFile->mHash[i]);
|
||||
}
|
||||
}
|
||||
srcFile->GetHash(outStr);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -11278,6 +11267,13 @@ String WinDebugger::DisassembleAt(intptr inAddress)
|
|||
{
|
||||
srcFile = dwSubProgram->GetLineSrcFile(*dwLineData);
|
||||
result += "S " + srcFile->GetLocalPath() + "\n";
|
||||
if (srcFile->mHashKind != DbgHashKind_None)
|
||||
{
|
||||
result += "H ";
|
||||
srcFile->GetHash(result);
|
||||
result += "\n";
|
||||
}
|
||||
|
||||
curLine = BF_MAX(0, dwLineData->mLine - 5);
|
||||
//for (; curLine <= dwLineData->mLine; curLine++)
|
||||
result += StrFormat("L %d %d\n", curLine, dwLineData->mLine - curLine + 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue