1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

Added errors panel

This commit is contained in:
Brian Fiete 2020-01-12 09:21:50 -08:00
parent aa0277485f
commit 9d1b85cceb
8 changed files with 234 additions and 90 deletions

View file

@ -2248,7 +2248,7 @@ BeMCOperand BeMCContext::GetOperand(BeValue* value, bool allowMetaResult, bool a
mcOperand.mKind = BeMCOperandKind_Immediate_i64;
break;
default:
NotImpl();
Fail("Unhandled constant type");
}
mcOperand.mImmediate = constant->mInt64;
return mcOperand;
@ -3585,7 +3585,7 @@ void BeMCContext::CreatePhiAssign(BeMCBlock* mcBlock, const BeMCOperand& testVal
}
else
{
NotImpl();
SoftFail("Unhandled CreatePhiAssign value");
}
}
@ -4026,7 +4026,7 @@ bool BeMCContext::CouldBeReg(const BeMCOperand& operand)
return true;
}
bool BeMCContext::CheckForce(BeMCVRegInfo * vregInfo)
bool BeMCContext::CheckForce(BeMCVRegInfo* vregInfo)
{
if (!vregInfo->mIsRetVal)
{
@ -6080,7 +6080,7 @@ void BeMCContext::EmitModRM_XMM_IMM(int rx, BeMCOperand & imm)
sym = mCOFFObject->GetCOMDAT(name, data, 16, 16);
}
else
NotImpl();
SoftFail("Unhandled value type in EmitModRM_XMM_IMM");
BeMCRelocation reloc;
reloc.mKind = BeMCRelocationKind_REL32;
@ -9993,6 +9993,14 @@ bool BeMCContext::DoLegalization()
}
}
break;
case BeMCInstKind_DefPhi:
{
// This is from a PHI whose value was not used
RemoveInst(mcBlock, instIdx);
instIdx--;
continue;
}
break;
}
if ((pendingInitKind != BfIRInitType_NotNeeded) && (pendingInitKind != BfIRInitType_NotNeeded_AliveOnDecl))
@ -13860,7 +13868,8 @@ void BeMCContext::DoCodeEmission()
//mOut.Write((uint8)0xC3);
break;
default:
NotImpl();
SoftFail("Unhandled instruction in DoCodeEmission", inst->mDbgLoc);
break;
}
}
}
@ -14747,7 +14756,7 @@ void BeMCContext::Generate(BeFunction* function)
mDbgPreferredRegs[32] = X64Reg_R8;*/
//mDbgPreferredRegs[8] = X64Reg_RAX;
//mDebugging = function->mName ==
//mDebugging = function->mName == "?Do@ClassA@bf@@QEAAXXZ";
//"?ColorizeCodeString@IDEUtils@IDE@bf@@SAXPEAVString@System@3@W4CodeKind@123@@Z";
//"?Main@Program@bf@@CAHPEAV?$Array1@PEAVString@System@bf@@@System@2@@Z";
@ -15674,7 +15683,7 @@ void BeMCContext::Generate(BeFunction* function)
}
else
SoftFail("Invalid GEP");
SoftFail("Invalid GEP", inst->mDbgLoc);
}
else
{
@ -16350,7 +16359,7 @@ void BeMCContext::Generate(BeFunction* function)
}
break;
default:
NotImpl();
Fail("Unhandled BeInst type");
break;
}

View file

@ -6890,20 +6890,23 @@ BfTypedValue BfModule::FlushNullConditional(BfTypedValue result, bool ignoreNull
if (nullableTypedValue)
{
auto elementType = nullableType->GetUnderlyingType();
if (elementType->IsValuelessType())
if (elementType->IsVar())
{
// Do nothing
}
else if (elementType->IsValuelessType())
{
BfIRValue ptrValue = mBfIRBuilder->CreateInBoundsGEP(nullableTypedValue.mValue, 0, 1); // mHasValue
mBfIRBuilder->CreateStore(GetConstValue(1, GetPrimitiveType(BfTypeCode_Boolean)), ptrValue);
result = nullableTypedValue;
mBfIRBuilder->CreateStore(GetConstValue(1, GetPrimitiveType(BfTypeCode_Boolean)), ptrValue);
}
else
{
BfIRValue ptrValue = mBfIRBuilder->CreateInBoundsGEP(nullableTypedValue.mValue, 0, 1); // mValue
mBfIRBuilder->CreateStore(result.mValue, ptrValue);
ptrValue = mBfIRBuilder->CreateInBoundsGEP(nullableTypedValue.mValue, 0, 2); // mHasValue
mBfIRBuilder->CreateStore(GetConstValue(1, GetPrimitiveType(BfTypeCode_Boolean)), ptrValue);
result = nullableTypedValue;
mBfIRBuilder->CreateStore(GetConstValue(1, GetPrimitiveType(BfTypeCode_Boolean)), ptrValue);
}
result = nullableTypedValue;
}
mBfIRBuilder->CreateBr(pendingNullCond->mDoneBB);

View file

@ -652,12 +652,13 @@ void BfModule::TypeFailed(BfTypeInstance* typeInstance)
{
BfLogSysM("TypeFailed: %p\n", typeInstance);
typeInstance->mTypeFailed = true;
// Punt on field types - just substitute System.Object where we have NULLs
// Punt on field types - just substitute 'var' where we have NULLs
for (auto& fieldInstance : typeInstance->mFieldInstances)
{
{
if ((fieldInstance.mResolvedType == NULL) || (fieldInstance.mResolvedType->IsNull()))
{
fieldInstance.mResolvedType = mContext->mBfObjectType;
if (fieldInstance.mDataIdx >= 0)
fieldInstance.mResolvedType = GetPrimitiveType(BfTypeCode_Var);
}
if (fieldInstance.mOwner == NULL)
fieldInstance.mOwner = typeInstance;
@ -2268,6 +2269,8 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
if ((fieldInstance->mResolvedType != NULL) || (!fieldInstance->mFieldIncluded))
continue;
SetAndRestoreValue<BfFieldDef*> prevTypeRef(mContext->mCurTypeState->mCurFieldDef, field);
BfType* resolvedFieldType = NULL;
if (field->IsEnumCaseEntry())
@ -2304,15 +2307,14 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
// For 'let', make read-only
}
else
{
SetAndRestoreValue<BfFieldDef*> prevTypeRef(mContext->mCurTypeState->mCurFieldDef, field);
{
resolvedFieldType = ResolveTypeRef(field->mTypeRef, BfPopulateType_Declaration, BfResolveTypeRefFlag_NoResolveGenericParam);
if (resolvedFieldType == NULL)
{
// Failed, just put in placeholder 'var'
AssertErrorState();
resolvedFieldType = GetPrimitiveType(BfTypeCode_Var);
}
}
}
if (resolvedFieldType->IsMethodRef())

View file

@ -198,7 +198,7 @@ BfAstNode* BfReducer::Fail(const StringImpl& errorMsg, BfAstNode* refNode)
if (mPassInstance->HasLastFailedAt(refNode)) // No duplicate failures
return NULL;
auto error = mPassInstance->Fail(errorMsg, refNode);
if (error != NULL)
if ((error != NULL) && (mSource != NULL))
error->mProject = mSource->mProject;
return NULL;
}
@ -207,7 +207,7 @@ BfAstNode* BfReducer::FailAfter(const StringImpl& errorMsg, BfAstNode* prevNode)
{
mStmtHasError = true;
auto error = mPassInstance->FailAfter(errorMsg, prevNode);
if (error != NULL)
if ((error != NULL) && (mSource != NULL))
error->mProject = mSource->mProject;
return NULL;
}
@ -4299,7 +4299,7 @@ BfAstNode* BfReducer::CreateStatement(BfAstNode* node, CreateStmtFlags createStm
return stmt;
auto error = mPassInstance->FailAfterAt("Semicolon expected", node->GetSourceData(), stmt->GetSrcEnd() - 1);
if (error != NULL)
if ((error != NULL) && (mSource != NULL))
error->mProject = mSource->mProject;
mPrevStmtHadError = true;
return stmt;