1
0
Fork 0
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:
Brian Fiete 2019-11-22 12:28:24 -08:00
parent 533ef0856b
commit 7b8251c311
11 changed files with 65 additions and 22 deletions

View file

@ -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");
}

View file

@ -17981,3 +17981,4 @@ void BfExprEvaluator::Visit(BfBinaryOperatorExpression* binOpExpr)
PerformBinaryOperation(binOpExpr->mLeft, binOpExpr->mRight, binOpExpr->mOp, binOpExpr->mOpToken, BfBinOpFlag_None);
}
//

View file

@ -593,6 +593,7 @@ enum BfIRAttribute
BFIRAttribute_NoFramePointerElim,
BFIRAttribute_DllImport,
BFIRAttribute_DllExport,
BFIRAttribute_NoRecurse
};
struct BfIRFunctionType

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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;
}
}

View file

@ -760,6 +760,7 @@ public:
void RemoveLines(DbgModule* debugModule, DbgSubprogram* dbgSubprogram, bool isHotReplaced);
void RehupLineData();
const String& GetLocalPath();
void GetHash(String& hashStr);
};
class DwCommonFrameDescriptor

View file

@ -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);