1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Fixed build cache error, fixed ordered hash bug

Fixed error writing to build.bat when build directory was externally cleared
Fixed ordered hash errors where the fields were added but the hash didn't change
This commit is contained in:
Brian Fiete 2019-09-04 11:17:23 -07:00
parent d26e2957b0
commit 8659afa944
2 changed files with 32 additions and 1 deletions

View file

@ -245,6 +245,28 @@ void BeIRCodeGen::Hash(BeHashContext& hashCtx)
hashCtx.Mixin(mIsOptimized);
if (mBeModule != NULL)
mBeModule->Hash(hashCtx);
Array<BeStructType*> structHashList;
for (auto beType : mBeContext->mTypes)
{
if (!beType->IsStruct())
continue;
auto beStructType = (BeStructType*)beType;
if (beStructType->mHashId != -1)
continue;
structHashList.Add(beStructType);
}
structHashList.Sort([](BeStructType* lhs, BeStructType* rhs)
{
return lhs->mName < rhs->mName;
});
for (auto beStructType : structHashList)
{
beStructType->HashReference(hashCtx);
}
}
bool BeIRCodeGen::IsModuleEmpty()

View file

@ -112,6 +112,15 @@ void BfCodeGenDirectoryData::Write()
String fileName = GetDataFileName();
if (!fileStream.Open(fileName, "wb"))
{
String directory = GetFileDir(fileName);
if (!DirectoryExists(directory))
{
// Someone else (or the user) cleared this directory
DoBfLog(2, "BfCodeGen cleared cache because '%s' was removed\n", directory.c_str());
mFileMap.Clear();
return;
}
mError = "Failed to write to " + fileName;
return;
}