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

Avoid showing line number when its not relevant

This commit is contained in:
Brian Fiete 2019-10-17 06:47:50 -07:00
parent e2dad5f838
commit e2428a11a3
3 changed files with 23 additions and 16 deletions

View file

@ -322,10 +322,10 @@ namespace IDE
} }
else else
{ {
IDEUtils.AppendWithOptionalQuotes(linkLine, scope String("-L", llvmDir, "/x86_64-w64-mingw32/lib")); /*IDEUtils.AppendWithOptionalQuotes(linkLine, scope String("-L", llvmDir, "/x86_64-w64-mingw32/lib"));
linkLine.Append(" "); linkLine.Append(" ");
IDEUtils.AppendWithOptionalQuotes(linkLine, scope String("-L", llvmDir, "/lib/gcc/x86_64-w64-mingw32/5.2.0")); IDEUtils.AppendWithOptionalQuotes(linkLine, scope String("-L", llvmDir, "/lib/gcc/x86_64-w64-mingw32/5.2.0"));
linkLine.Append(" "); linkLine.Append(" ");*/
} }
} }
else // Microsoft else // Microsoft

View file

@ -170,7 +170,8 @@ file(GLOB SRC_FILES
Compiler/BfSystem.cpp Compiler/BfSystem.cpp
Compiler/BfUtil.cpp Compiler/BfUtil.cpp
Compiler/BfVarDeclChecker.cpp Compiler/BfVarDeclChecker.cpp
Compiler/MemReporter.cpp Compiler/BfTargetTriple.cpp
Compiler/MemReporter.cpp
) )
# Add library to build. # Add library to build.

View file

@ -390,14 +390,17 @@ void BfIRCodeGen::Fail(const StringImpl& error)
if (mFailed) if (mFailed)
return; return;
auto dbgLoc = mIRBuilder->getCurrentDebugLocation(); if (mHasDebugLoc)
if (dbgLoc)
{ {
llvm::DIFile* file = NULL; auto dbgLoc = mIRBuilder->getCurrentDebugLocation();
if (llvm::DIScope* scope = llvm::dyn_cast<llvm::DIScope>(dbgLoc.getScope())) if (dbgLoc)
{ {
BfIRCodeGenBase::Fail(StrFormat("%s at line %d:%d in %s/%s", error.c_str(), dbgLoc.getLine(), dbgLoc.getCol(), scope->getDirectory().data(), scope->getFilename().data())); llvm::DIFile* file = NULL;
return; if (llvm::DIScope* scope = llvm::dyn_cast<llvm::DIScope>(dbgLoc.getScope()))
{
BfIRCodeGenBase::Fail(StrFormat("%s at line %d:%d in %s/%s", error.c_str(), dbgLoc.getLine(), dbgLoc.getCol(), scope->getDirectory().data(), scope->getFilename().data()));
return;
}
} }
} }
@ -2615,6 +2618,7 @@ void BfIRCodeGen::HandleNextCmd()
case BfIRCmd_StatementStart: case BfIRCmd_StatementStart:
// We only commit the debug loc for statement starts // We only commit the debug loc for statement starts
mIRBuilder->SetCurrentDebugLocation(mDebugLoc); mIRBuilder->SetCurrentDebugLocation(mDebugLoc);
mHasDebugLoc = true;
break; break;
case BfIRCmd_ObjectAccessCheck: case BfIRCmd_ObjectAccessCheck:
{ {
@ -3942,6 +3946,8 @@ bool BfIRCodeGen::WriteObjectFile(const StringImpl& outFileName, const BfCodeGen
// //
// } // }
mHasDebugLoc = false; // So fails don't show a line number
bool enableLTO = codeGenOptions.mLTOType != BfLTOType_None; bool enableLTO = codeGenOptions.mLTOType != BfLTOType_None;
if (enableLTO) if (enableLTO)
@ -4166,8 +4172,8 @@ int BF_LinuxFixLinkage()
int BF_AARC64_Linkage() int BF_AARC64_Linkage()
{ {
LLVMInitializeAArch64TargetInfo(); LLVMInitializeAArch64TargetInfo();
LLVMInitializeAArch64Target(); LLVMInitializeAArch64Target();
LLVMInitializeAArch64TargetMC(); LLVMInitializeAArch64TargetMC();
return 0; return 0;
} }
@ -4175,15 +4181,15 @@ int BF_AARC64_Linkage()
void BfIRCodeGen::StaticInit() void BfIRCodeGen::StaticInit()
{ {
LLVMInitializeX86TargetInfo(); LLVMInitializeX86TargetInfo();
LLVMInitializeX86Target(); LLVMInitializeX86Target();
LLVMInitializeX86TargetMC(); LLVMInitializeX86TargetMC();
LLVMInitializeX86AsmPrinter(); LLVMInitializeX86AsmPrinter();
LLVMInitializeX86AsmParser(); LLVMInitializeX86AsmParser();
LLVMInitializeX86Disassembler(); LLVMInitializeX86Disassembler();
LLVMInitializeAArch64TargetInfo(); LLVMInitializeAArch64TargetInfo();
LLVMInitializeAArch64Target(); LLVMInitializeAArch64Target();
LLVMInitializeAArch64TargetMC(); LLVMInitializeAArch64TargetMC();
LLVMInitializeAArch64AsmPrinter(); LLVMInitializeAArch64AsmPrinter();
//LLVMInitializeAArch64Parser(); //LLVMInitializeAArch64Parser();