1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixes for ShowWrongHash, looking into debug info issues in opt llvm

This commit is contained in:
Brian Fiete 2019-09-24 08:58:04 -07:00
parent c67fbd66ba
commit 54d5884213
8 changed files with 69 additions and 34 deletions

View file

@ -34,7 +34,7 @@ namespace Beefy.theme.dark
public bool mHasClosed;
public Insets mRelWidgetMouseInsets ~ delete _;
public bool mAllowMouseInsideSelf;
public bool mRequireMouseInside;
public bool mAllowMouseOutside;
public const float cShadowSize = 8;
@ -224,7 +224,7 @@ namespace Beefy.theme.dark
if (mWidgetWindow == null)
return;
if (!mRequireMouseInside)
if (mAllowMouseOutside)
return;
float rootX;

View file

@ -6182,6 +6182,10 @@ namespace IDE
sourceViewPanel.SetLoadCmd(loadCmd);
}
}
else if ((hash != .None) && (hash != sourceViewPanel.mLoadedHash))
{
sourceViewPanel.ShowWrongHash();
}
int showHotIdx = -1;
if (!onlyShowCurrent)
@ -11408,6 +11412,7 @@ namespace IDE
continue;
//TODO: Check to see if this file is in the dependency list of the executing project
if (!editData.mProjectSources.IsEmpty)
mHaveSourcesChangedExternallySinceLastCompile = true;
editData.SetSavedData(null, IdSpan());

View file

@ -2022,7 +2022,7 @@ namespace IDE.ui
if (!mClosed)
{
if ((DarkTooltipManager.sTooltip != null) && (!DarkTooltipManager.sTooltip.mRequireMouseInside))
if ((DarkTooltipManager.sTooltip != null) && (DarkTooltipManager.sTooltip.mAllowMouseOutside))
DarkTooltipManager.CloseTooltip();
if (IsInPanel())

View file

@ -2729,7 +2729,7 @@ namespace IDE.ui
{
if (mWidgetWindow.IsKeyDown(.Control))
{
if ((DarkTooltipManager.sTooltip != null) && (!DarkTooltipManager.sTooltip.mRequireMouseInside))
if ((DarkTooltipManager.sTooltip != null) && (DarkTooltipManager.sTooltip.mAllowMouseOutside))
DarkTooltipManager.CloseTooltip();
gApp.mSettings.mTutorialsFinished.mCtrlCursor = true;
}
@ -2739,7 +2739,7 @@ namespace IDE.ui
let tooltip = DarkTooltipManager.ShowTooltip("Hold CTRL when using UP and DOWN", this, cursorX - GS!(24), cursorY - GS!(40));
if (tooltip != null)
tooltip.mRequireMouseInside = false;
tooltip.mAllowMouseOutside = true;
return;
}
}

View file

@ -303,6 +303,8 @@ namespace IDE.ui
{
switch (lhs)
{
case .None:
return rhs case .None;
case .MD5(let lhsMD5):
if (rhs case .MD5(let rhsMD5))
return lhsMD5 == rhsMD5;
@ -3106,7 +3108,7 @@ namespace IDE.ui
ResizeComponents();
}
void ShowWrongHash()
public void ShowWrongHash()
{
CloseHeader();
@ -3335,6 +3337,38 @@ namespace IDE.ui
CheckBinary();
}
void CheckAdjustFile()
{
if (mLoadedHash == .None)
return;
String text = scope .();
if (File.ReadAllText(mFilePath, text, true) case .Err)
return;
SourceHash textHash = SourceHash.Create(mLoadedHash.GetKind(), text);
if (textHash == mLoadedHash)
return;
if (text.Contains('\r'))
{
text.Replace("\r", "");
}
else
{
text.Replace("\n", "\r\n");
}
textHash = SourceHash.Create(mLoadedHash.GetKind(), text);
if (textHash == mLoadedHash)
{
if (File.WriteAllText(mFilePath, text) case .Err)
{
gApp.mFileWatcher.OmitFileChange(mFilePath, text);
return;
}
}
}
void RetryLoad()
{
var prevHash = mLoadedHash;
@ -5386,6 +5420,7 @@ namespace IDE.ui
{
if ((int)mOldVerLoadExecutionInstance.mExitCode == 0)
{
CheckAdjustFile();
RetryLoad();
}
else
@ -5403,6 +5438,7 @@ namespace IDE.ui
if (result == .Failed)
gApp.OutputErrorLine("Failed to retrieve source from {}", mOldVerLoadCmd);
CheckAdjustFile();
RetryLoad();
DeleteAndNullify!(mOldVerHTTPRequest);
}

View file

@ -4989,7 +4989,7 @@ void COFF::CvParseIPI()
int offset = dataOffset;
for (int idx = 0; idx < recordCount; idx++)
{
BF_ASSERT(((offset) & 3) == 0);
//BF_ASSERT(((offset) & 3) == 0);
uint8* data = mCvIPIReader.GetTempPtr(offset, 4);
uint16 trLength = GET(uint16);
int offsetStart = offset;

View file

@ -1,5 +1,6 @@
#include "BfIRCodeGen.h"
#include "BfModule.h"
#include "BeefySysLib/util/BeefPerf.h"
#pragma warning(push)
#pragma warning(disable:4141)
@ -4057,6 +4058,19 @@ bool BfIRCodeGen::WriteObjectFile(const StringImpl& outFileName, const BfCodeGen
}
bool success = PM.run(*mLLVMModule);
if ((codeGenOptions.mOptLevel > BfOptLevel_O0) && (codeGenOptions.mWriteLLVMIR))
{
BP_ZONE("BfCodeGen::RunLoop.LLVM.IR");
String fileName = outFileName;
int dotPos = (int)fileName.LastIndexOf('.');
if (dotPos != -1)
fileName.RemoveToEnd(dotPos);
fileName += "_OPT.ll";
String irError;
WriteIR(fileName, irError);
}
}
return true;

View file

@ -1611,30 +1611,7 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
localDef->mAddr = AllocLocalVariable(resolvedType, localDef->mName);
}
// if ((!hadVarType) && (varDecl->mInitializer != NULL))
// {
// if (exprEvaluator != NULL)
// {
// if ((initValue) && (initValue.mType->IsNullable()))
// {
// auto boolType = GetPrimitiveType(BfTypeCode_Boolean);
// initValue = LoadValue(initValue);
// exprEvaluator->mResult = BfTypedValue(mBfIRBuilder->CreateExtractValue(initValue.mValue, 2), boolType);
// handledExprBoolResult = true;
//
// if (!resolvedType->IsNullable())
// initValue = BfTypedValue(mBfIRBuilder->CreateExtractValue(initValue.mValue, 1), initValue.mType->GetUnderlyingType());
// }
// else if (initValue)
// {
// TryInitVar(varDecl, &localDef, initValue, exprEvaluator->mResult);
// handledExprBoolResult = true;
// handledVarStore = true;
// handledVarInit = true;
// }
// }
// }
bool wantsStore = false;
if ((initValue) && (!handledVarStore) && (!isConst) && (!initHandled))
{
initValue = LoadValue(initValue);
@ -1651,7 +1628,7 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
localDef->mValue = initValue.mValue;
if ((localDef->mAddr) && (!localDef->mResolvedType->IsValuelessType()))
{
mBfIRBuilder->CreateStore(initValue.mValue, localDef->mAddr);
wantsStore = true;
}
else
{
@ -1727,7 +1704,10 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
if (localDef->mConstValue)
initType = BfIRInitType_NotNeeded;
return AddLocalVariableDef(localDef, true, false, BfIRValue(), initType);
BfLocalVariable* localVar = AddLocalVariableDef(localDef, true, false, BfIRValue(), initType);
if (wantsStore)
mBfIRBuilder->CreateStore(initValue.mValue, localVar->mAddr);
return localVar;
}
BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varDecl, BfTypedValue val, bool updateSrcLoc, bool forceAddr)