Browse Source

Failover case for unhandled type in CreateTypeDeclaration

Brian Fiete 1 year ago
parent
commit
b889a7e208
2 changed files with 11 additions and 1 deletions
  1. 4 0
      IDEHelper/Backend/BeIRCodeGen.cpp
  2. 7 1
      IDEHelper/Compiler/BfIRBuilder.cpp

+ 4 - 0
IDEHelper/Backend/BeIRCodeGen.cpp

@@ -3448,6 +3448,8 @@ void BeIRCodeGen::HandleNextCmd()
 			CMD_PARAM(bool, alwaysPreserve);
 			CMD_PARAM(int, flags);
 
+			BF_ASSERT(type != NULL);
+
 			auto dbgFunc = (BeDbgFunction*)scope;
 
 			auto dbgVar = mBeModule->mOwnedValues.Alloc<BeDbgVariable>();
@@ -3498,6 +3500,8 @@ void BeIRCodeGen::HandleNextCmd()
 			CMD_PARAM(BeMDNode*, type);
 			CMD_PARAM(int, initType);
 
+			BF_ASSERT(type != NULL);
+
 			auto dbgVar = mBeModule->mOwnedValues.Alloc<BeDbgVariable>();
 			dbgVar->mName = name;
 			dbgVar->mType = type;

+ 7 - 1
IDEHelper/Compiler/BfIRBuilder.cpp

@@ -2720,7 +2720,7 @@ public:
 #endif
 
 void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
-{
+{	
 	auto populateModule = mModule->mContext->mUnreifiedModule;
 	auto typeInstance = type->ToTypeInstance();
 	if ((typeInstance != NULL) && (typeInstance->mModule != NULL))
@@ -3108,6 +3108,12 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
 		}
 		return;
 	}
+	else
+	{
+		irType = GetPrimitiveType(BfTypeCode_None);
+		if (wantDIData)
+			diType = DbgCreateBasicType("void", 0, 0, llvm::dwarf::DW_ATE_address);		
+	}
 
 	if (irType)
 		SetType(type, irType);