Jelajahi Sumber

Trailing whitespace trimming

Brian Fiete 3 tahun lalu
induk
melakukan
7f328385db
88 mengubah file dengan 4456 tambahan dan 4633 penghapusan
  1. 5 7
      IDEHelper/COFFData.h
  2. 42 44
      IDEHelper/Compiler/BfAst.cpp
  3. 138 145
      IDEHelper/Compiler/BfAst.h
  4. 17 18
      IDEHelper/Compiler/BfAstAllocator.cpp
  5. 17 20
      IDEHelper/Compiler/BfAstAllocator.h
  6. 132 136
      IDEHelper/Compiler/BfAutoComplete.cpp
  7. 33 33
      IDEHelper/Compiler/BfAutoComplete.h
  8. 88 92
      IDEHelper/Compiler/BfCodeGen.cpp
  9. 22 23
      IDEHelper/Compiler/BfCodeGen.h
  10. 143 146
      IDEHelper/Compiler/BfCompiler.cpp
  11. 66 67
      IDEHelper/Compiler/BfCompiler.h
  12. 29 29
      IDEHelper/Compiler/BfConstResolver.cpp
  13. 2 2
      IDEHelper/Compiler/BfConstResolver.h
  14. 163 164
      IDEHelper/Compiler/BfContext.cpp
  15. 48 48
      IDEHelper/Compiler/BfContext.h
  16. 155 155
      IDEHelper/Compiler/BfDefBuilder.cpp
  17. 7 7
      IDEHelper/Compiler/BfDefBuilder.h
  18. 16 18
      IDEHelper/Compiler/BfDeferEvalChecker.cpp
  19. 2 3
      IDEHelper/Compiler/BfDeferEvalChecker.h
  20. 162 173
      IDEHelper/Compiler/BfDemangler.cpp
  21. 10 10
      IDEHelper/Compiler/BfDemangler.h
  22. 49 52
      IDEHelper/Compiler/BfElementVisitor.cpp
  23. 4 4
      IDEHelper/Compiler/BfElementVisitor.h
  24. 1 39
      IDEHelper/Compiler/BfExprEvaluator.cpp
  25. 61 62
      IDEHelper/Compiler/BfExprEvaluator.h
  26. 5 5
      IDEHelper/Compiler/BfFixits.h
  27. 136 137
      IDEHelper/Compiler/BfIRBuilder.cpp
  28. 138 139
      IDEHelper/Compiler/BfIRBuilder.h
  29. 136 139
      IDEHelper/Compiler/BfIRCodeGen.cpp
  30. 17 18
      IDEHelper/Compiler/BfIRCodeGen.h
  31. 164 164
      IDEHelper/Compiler/BfMangler.cpp
  32. 15 15
      IDEHelper/Compiler/BfMangler.h
  33. 151 151
      IDEHelper/Compiler/BfModule.cpp
  34. 176 176
      IDEHelper/Compiler/BfModule.h
  35. 142 142
      IDEHelper/Compiler/BfModuleTypeUtils.cpp
  36. 10 11
      IDEHelper/Compiler/BfNamespaceVisitor.cpp
  37. 2 2
      IDEHelper/Compiler/BfNamespaceVisitor.h
  38. 92 101
      IDEHelper/Compiler/BfParser.cpp
  39. 40 40
      IDEHelper/Compiler/BfParser.h
  40. 138 144
      IDEHelper/Compiler/BfPrinter.cpp
  41. 24 25
      IDEHelper/Compiler/BfPrinter.h
  42. 136 146
      IDEHelper/Compiler/BfReducer.cpp
  43. 14 14
      IDEHelper/Compiler/BfReducer.h
  44. 14 14
      IDEHelper/Compiler/BfResolvePass.cpp
  45. 7 7
      IDEHelper/Compiler/BfResolvePass.h
  46. 136 139
      IDEHelper/Compiler/BfResolvedTypeUtils.cpp
  47. 153 155
      IDEHelper/Compiler/BfResolvedTypeUtils.h
  48. 7 7
      IDEHelper/Compiler/BfSource.cpp
  49. 10 10
      IDEHelper/Compiler/BfSource.h
  50. 42 43
      IDEHelper/Compiler/BfSourceClassifier.cpp
  51. 11 11
      IDEHelper/Compiler/BfSourceClassifier.h
  52. 2 2
      IDEHelper/Compiler/BfSourcePositionFinder.cpp
  53. 1 1
      IDEHelper/Compiler/BfSourcePositionFinder.h
  54. 150 151
      IDEHelper/Compiler/BfStmtEvaluator.cpp
  55. 142 144
      IDEHelper/Compiler/BfSystem.cpp
  56. 149 155
      IDEHelper/Compiler/BfSystem.h
  57. 1 1
      IDEHelper/Compiler/BfTargetTriple.cpp
  58. 0 1
      IDEHelper/Compiler/BfType.h
  59. 2 2
      IDEHelper/Compiler/BfUtil.cpp
  60. 12 13
      IDEHelper/Compiler/BfUtil.h
  61. 1 1
      IDEHelper/Compiler/BfVarDeclChecker.cpp
  62. 0 1
      IDEHelper/Compiler/BfVarDeclChecker.h
  63. 132 139
      IDEHelper/Compiler/CeDebugger.cpp
  64. 15 15
      IDEHelper/Compiler/CeDebugger.h
  65. 141 142
      IDEHelper/Compiler/CeMachine.cpp
  66. 72 72
      IDEHelper/Compiler/CeMachine.h
  67. 7 7
      IDEHelper/Compiler/MemReporter.cpp
  68. 16 17
      IDEHelper/Compiler/MemReporter.h
  69. 7 7
      IDEHelper/DbgMiniDump.cpp
  70. 1 1
      IDEHelper/DbgMiniDump.h
  71. 57 72
      IDEHelper/DebugManager.cpp
  72. 3 3
      IDEHelper/DebugManager.h
  73. 17 18
      IDEHelper/DebugVisualizers.cpp
  74. 6 6
      IDEHelper/DebugVisualizers.h
  75. 7 7
      IDEHelper/Debugger.cpp
  76. 23 25
      IDEHelper/Debugger.h
  77. 3 3
      IDEHelper/LLVMUtils.h
  78. 37 40
      IDEHelper/NetManager.cpp
  79. 4 4
      IDEHelper/NetManager.h
  80. 2 2
      IDEHelper/SpellChecker.cpp
  81. 8 9
      IDEHelper/StrBloomMap.h
  82. 4 5
      IDEHelper/StrHashMap.h
  83. 14 20
      IDEHelper/VSSupport.cpp
  84. 36 37
      IDEHelper/X64.cpp
  85. 10 11
      IDEHelper/X64.h
  86. 41 42
      IDEHelper/X86.cpp
  87. 4 4
      IDEHelper/X86.h
  88. 1 1
      IDEHelper/X86Target.cpp

+ 5 - 7
IDEHelper/COFFData.h

@@ -7,7 +7,6 @@ struct CV_LVAR_ADDR_GAP;
 
 NS_BF_BEGIN
 
-
 #define PE_SIZEOF_SHORT_NAME              8
 #define PE_DIRECTORY_ENTRY_EXPORT         0   // Export Directory
 #define PE_NUMBEROF_DIRECTORY_ENTRIES    16
@@ -17,7 +16,6 @@ NS_BF_BEGIN
 #define PE_MACHINE_X86 0x14c
 #define PE_MACHINE_X64 0x8664
 
-
 // DOS .EXE header
 struct PEHeader
 {
@@ -174,8 +172,8 @@ struct PE_NTHeaders64
 
 struct PESectionHeader
 {
-	char    mName[IMAGE_SIZEOF_SHORT_NAME];	
-	DWORD   mVirtualSize;	
+	char    mName[IMAGE_SIZEOF_SHORT_NAME];
+	DWORD   mVirtualSize;
 	DWORD   mVirtualAddress;
 	DWORD   mSizeOfRawData;
 	DWORD   mPointerToRawData;
@@ -234,8 +232,8 @@ struct PE_SymInfoAux
 //	int GetPrologSize() const { return mAttributes & 0xF; }
 //
 //	// # regs saved
-//	int GetNumSavedRegs() const { return (mAttributes >> 8) & 0x7; }	
-//	bool HasSEH() const { return (mAttributes >> 9) & 1; }	
+//	int GetNumSavedRegs() const { return (mAttributes >> 8) & 0x7; }
+//	bool HasSEH() const { return (mAttributes >> 9) & 1; }
 //	bool UseBP() const { return (mAttributes >> 10) & 1; }
 //
 //	// cbFrame: frame pointer
@@ -279,7 +277,7 @@ struct COFFFrameProgram
 		Command_Align,
 		Command_Set,
 		Command_Deref,
-		Command_Value,		
+		Command_Value,
 		Command_Value8
 	};
 

+ 42 - 44
IDEHelper/Compiler/BfAst.cpp

@@ -17,11 +17,11 @@ BfStructuralVisitor::BfStructuralVisitor()
 }
 
 void BfStructuralVisitor::VisitMembers(BfBlock* node)
-{	
+{
 	for (auto& child : *node)
-	{		
+	{
 		child->Accept(this);
-	}			
+	}
 }
 
 void BfStructuralVisitor::VisitChildNoRef(BfAstNode* node)
@@ -673,7 +673,7 @@ void BfStructuralVisitor::Visit(BfNamespaceDeclaration* namespaceDeclaration)
 
 void BfStructuralVisitor::Visit(BfBlock* block)
 {
-	Visit(block->ToBase());	
+	Visit(block->ToBase());
 }
 
 void BfStructuralVisitor::Visit(BfUnscopedBlock* block)
@@ -688,7 +688,7 @@ void BfStructuralVisitor::Visit(BfBlockExtension* block)
 
 void BfStructuralVisitor::Visit(BfRootNode* rootNode)
 {
-	Visit(rootNode->ToBase());	
+	Visit(rootNode->ToBase());
 }
 
 void BfStructuralVisitor::Visit(BfInlineAsmStatement* asmStmt)
@@ -715,7 +715,7 @@ BfAstTypeInfo::BfAstTypeInfo(const char* name, BfAstTypeInfo* baseType, BfAstAcc
 	if (mBaseType != NULL)
 	{
 		mBaseType->mDerivedTypes.Add(this);
-	}		
+	}
 	sTypeCount++;
 
 #ifdef _DEBUG
@@ -800,7 +800,7 @@ bool BfAstNode::IsMissingSemicolon()
 		return (attribExpr->mStatement == NULL) || (attribExpr->mStatement->IsMissingSemicolon());
 
 	if (auto stmt = BfNodeDynCast<BfStatement>(this))
-		return stmt->mTrailingSemicolon == NULL;	
+		return stmt->mTrailingSemicolon == NULL;
 
 	return false;
 }
@@ -832,7 +832,7 @@ bool BfAstNode::WantsWarning(int warningNumber)
 }
 
 bool BfAstNode::LocationEquals(BfAstNode* otherNode)
-{	
+{
 	return (GetSourceData() == otherNode->GetSourceData()) &&
 		(GetSrcStart() == otherNode->GetSrcStart()) &&
 		(GetSrcEnd() == otherNode->GetSrcEnd());
@@ -851,7 +851,7 @@ String BfAstNode::LocationToString()
 		return String();
 
 	String loc;
-	
+
 	int line = -1;
 	int lineChar = -1;
 	parserData->GetLineCharAtIdx(mSrcStart, line, lineChar);
@@ -864,10 +864,10 @@ String BfAstNode::LocationToString()
 }
 
 void BfAstNode::Add(BfAstNode* bfAstNode)
-{	
+{
 #ifdef BF_AST_HAS_PARENT_MEMBER
 	BF_ASSERT(bfAstNode->mParent == NULL);
-	bfAstNode->mParent = this;	
+	bfAstNode->mParent = this;
 #endif
 
 	if (!IsInitialized())
@@ -897,7 +897,7 @@ void BfAstNode::Add(BfAstNode* bfAstNode)
 		SetSrcStart(childSrcStart);
 	if (childSrcEnd > prevSrcEnd)
 		SetSrcEnd(childSrcEnd);
-#else	
+#else
 	BF_ASSERT(mSrcStart >= 0);
 	BF_ASSERT(bfAstNode->mSrcStart >= 0);
 
@@ -934,14 +934,14 @@ void BfAstNode::RemoveNextSibling()
 }
 
 void BfAstNode::DeleteNextSibling()
-{	
+{
 	//mNext->DeleteSelf();
 }
 
 void BfAstNode::Init(BfParser* bfParser)
 {
 	BF_ASSERT(GetSourceData() == bfParser->mSourceData);
-	Init(bfParser->mTriviaStart, bfParser->mTokenStart, bfParser->mTokenEnd);		
+	Init(bfParser->mTriviaStart, bfParser->mTokenStart, bfParser->mTokenEnd);
 }
 
 void BfAstNode::Accept(BfStructuralVisitor* bfVisitor)
@@ -960,7 +960,7 @@ bool BfAstNode::IsTemporary()
 
 int BfAstNode::GetStartCharId()
 {
-	if (!IsTemporary())	
+	if (!IsTemporary())
 	{
 		auto bfParser = GetSourceData()->ToParserData();
 		if (bfParser != NULL)
@@ -970,8 +970,8 @@ int BfAstNode::GetStartCharId()
 }
 
 BfSourceData* BfAstNode::GetSourceData()
-{	
-#ifdef BF_AST_ALLOCATOR_USE_PAGES	
+{
+#ifdef BF_AST_ALLOCATOR_USE_PAGES
 	//BF_ASSERT((intptr)this > 0x4200000000);
 	BfAstPageHeader* pageHeader = (BfAstPageHeader*)((intptr)this & ~(BfAstAllocManager::PAGE_SIZE - 1));
 	return pageHeader->mSourceData;
@@ -1021,14 +1021,14 @@ String BfAstNode::ToString()
 	int srcLen = GetSrcLength();
 	if (srcLen <= 0)
 	{
-		if (auto namedTypeRef = BfNodeDynCast<BfNamedTypeReference>(this))		
-			return namedTypeRef->mNameNode->ToString();					
+		if (auto namedTypeRef = BfNodeDynCast<BfNamedTypeReference>(this))
+			return namedTypeRef->mNameNode->ToString();
 
 		return "";
 	}
 
 	auto source = GetSourceData();
-	String str(source->mSrc + GetSrcStart(), srcLen);	
+	String str(source->mSrc + GetSrcStart(), srcLen);
 	return str;
 }
 
@@ -1057,7 +1057,7 @@ void BfAstNode::ToString(StringImpl& str)
 	}
 
 	auto source = GetSourceData();
-	str.Append(source->mSrc + GetSrcStart(), srcLen);	
+	str.Append(source->mSrc + GetSrcStart(), srcLen);
 }
 
 bool BfAstNode::Equals(const StringImpl& str)
@@ -1079,7 +1079,7 @@ bool BfAstNode::Equals(const StringView& str)
 }
 
 bool BfAstNode::Equals(const char* str)
-{	
+{
 	auto source = GetSourceData();
 	const char* ptrLhs = source->mSrc + mSrcStart;
 	const char* ptrLhsEnd = source->mSrc + mSrcEnd;
@@ -1087,7 +1087,7 @@ bool BfAstNode::Equals(const char* str)
 
 	while (true)
 	{
-		char cRhs = *(ptrRhs++);		
+		char cRhs = *(ptrRhs++);
 		if (cRhs == 0)
 			return ptrLhs == ptrLhsEnd;
 		if (ptrLhs == ptrLhsEnd)
@@ -1098,7 +1098,6 @@ bool BfAstNode::Equals(const char* str)
 	}
 }
 
-
 //////////////////////////////////////////////////////////////////////////
 
 void BfBlock::Init(const SizedArrayImpl<BfAstNode*>& vec, BfAstAllocator* alloc)
@@ -1112,18 +1111,18 @@ void BfBlock::Init(const SizedArrayImpl<BfAstNode*>& vec, BfAstAllocator* alloc)
 	{
 		int bytesLeft = alloc->GetCurPageBytesLeft();
 		int useElems = std::min(bytesLeft / (int)sizeof(ASTREF(BfAstNode*)), elemsLeft);
-		BfBlockExtension* nextExt = NULL;		
+		BfBlockExtension* nextExt = NULL;
 		BfSizedArray<ASTREF(BfAstNode*)>& childArrRef = (curExt != NULL) ? curExt->mChildArr : mChildArr;
 		childArrRef.mVals = (ASTREF(BfAstNode*)*)alloc->AllocBytes(useElems * sizeof(ASTREF(BfAstNode*)), sizeof(ASTREF(BfAstNode*)));
 		childArrRef.mSize = useElems;
-		if (useElems < elemsLeft)		
+		if (useElems < elemsLeft)
 		{
 			nextExt = alloc->Alloc<BfBlockExtension>();
 			useElems--;
 		}
 
 		for (int i = 0; i < useElems; i++)
-			childArrRef[i] = vec[curIdx++];			
+			childArrRef[i] = vec[curIdx++];
 		if (nextExt != NULL)
 		{
 			childArrRef[useElems] = nextExt;
@@ -1131,7 +1130,7 @@ void BfBlock::Init(const SizedArrayImpl<BfAstNode*>& vec, BfAstAllocator* alloc)
 		}
 		elemsLeft -= useElems;
 	}
-#else	
+#else
 	BfSizedArrayInitIndirect(mChildArr, vec, alloc);
 #endif
 }
@@ -1157,10 +1156,10 @@ int BfBlock::GetSize()
 {
 	int size = mChildArr.mSize;
 	if (mChildArr.mSize == 0)
-		return size;	
+		return size;
 	BfAstNode* backNode = mChildArr.mVals[mChildArr.mSize - 1];
 	while (true)
-	{		
+	{
 		if (auto blockExt = BfNodeDynCastExact<BfBlockExtension>(backNode))
 		{
 			size--;
@@ -1172,12 +1171,12 @@ int BfBlock::GetSize()
 			break;
 		}
 	}
-	
+
 	return size;
 }
 
 void BfBlock::SetSize(int wantSize)
-{	
+{
 	int size = mChildArr.mSize;
 	if (wantSize == size)
 		return;
@@ -1390,7 +1389,7 @@ const char* Beefy::BfTokenToString(BfToken token)
 	case BfToken_Extension:
 		return "extension";
 	case BfToken_Fallthrough:
-		return "fallthrough";	
+		return "fallthrough";
 	case BfToken_Finally:
 		return "finally";
 	case BfToken_Fixed:
@@ -1426,7 +1425,7 @@ const char* Beefy::BfTokenToString(BfToken token)
 	case BfToken_Namespace:
 		return "namespace";
 	case BfToken_New:
-		return "new";	
+		return "new";
 	case BfToken_Null:
 		return "null";
 	case BfToken_Nullable:
@@ -1578,7 +1577,7 @@ const char* Beefy::BfTokenToString(BfToken token)
 	case BfToken_Colon:
 		return ":";
 	case BfToken_Comma:
-		return ",";	
+		return ",";
 	case BfToken_Dot:
 	case BfToken_AutocompleteDot:
 		return ".";
@@ -1645,7 +1644,7 @@ bool Beefy::BfTokenIsKeyword(BfToken token)
 BfBinaryOp Beefy::BfAssignOpToBinaryOp(BfAssignmentOp assignmentOp)
 {
 	switch (assignmentOp)
-	{	
+	{
 	case BfAssignmentOp_Add:
 		return BfBinaryOp_Add;
 	case BfAssignmentOp_Subtract:
@@ -1681,9 +1680,9 @@ BfBinaryOp Beefy::BfAssignOpToBinaryOp(BfAssignmentOp assignmentOp)
 }
 
 int Beefy::BfGetBinaryOpPrecendence(BfBinaryOp binOp)
-{	
+{
 	switch (binOp)
-	{			
+	{
 	case BfBinaryOp_Multiply:
 	case BfBinaryOp_OverflowMultiply:
 	case BfBinaryOp_Divide:
@@ -1693,7 +1692,7 @@ int Beefy::BfGetBinaryOpPrecendence(BfBinaryOp binOp)
 	case BfBinaryOp_Subtract:
 	case BfBinaryOp_OverflowAdd:
 	case BfBinaryOp_OverflowSubtract:
-		return 13;	
+		return 13;
 	case BfBinaryOp_LeftShift:
 	case BfBinaryOp_RightShift:
 		return 12;
@@ -1722,7 +1721,7 @@ int Beefy::BfGetBinaryOpPrecendence(BfBinaryOp binOp)
 	case BfBinaryOp_StrictInEquality:
 		return 4;
 	case BfBinaryOp_ConditionalAnd:
-		return 3;	
+		return 3;
 	case BfBinaryOp_ConditionalOr:
 		return 2;
 	case BfBinaryOp_NullCoalesce:
@@ -1797,7 +1796,7 @@ const char* Beefy::BfGetOpName(BfUnaryOp unaryOp)
 	case BfUnaryOp_FromEnd: return "^";
 	case BfUnaryOp_PartialRangeUpTo: return "..<";
 	case BfUnaryOp_PartialRangeThrough: return "...";
-	case BfUnaryOp_PartialRangeFrom: return "...";	
+	case BfUnaryOp_PartialRangeFrom: return "...";
 	default: return "???";
 	}
 }
@@ -1929,7 +1928,6 @@ bool Beefy::BfCanOverloadOperator(BfUnaryOp unaryOp)
 	}
 }
 
-
 BfAssignmentOp Beefy::BfTokenToAssignmentOp(BfToken token)
 {
 	switch (token)
@@ -1941,7 +1939,7 @@ BfAssignmentOp Beefy::BfTokenToAssignmentOp(BfToken token)
 	case BfToken_MinusEquals:
 		return BfAssignmentOp_Subtract;
 	case BfToken_MultiplyEquals:
-		return BfAssignmentOp_Multiply;	
+		return BfAssignmentOp_Multiply;
 	case BfToken_AndPlusEquals:
 		return BfAssignmentOp_OverflowAdd;
 	case BfToken_AndMinusEquals:
@@ -2143,4 +2141,4 @@ String BfInlineAsmInstruction::AsmInst::ToString()
 	}
 
 	return s;
-}
+}

File diff ditekan karena terlalu besar
+ 138 - 145
IDEHelper/Compiler/BfAst.h


+ 17 - 18
IDEHelper/Compiler/BfAstAllocator.cpp

@@ -24,36 +24,35 @@ void BfBitSet::Init(int numBits)
 	memset(mBits, 0, numInts * 4);
 }
 
-
 bool BfBitSet::IsSet(int idx)
 {
 	return (mBits[idx / 32] & (1 << (idx % 32))) != 0;
 }
 
 void BfBitSet::Set(int idx)
-{	
+{
 	mBits[idx / 32] |= (1 << (idx % 32));
 }
 
 void BfBitSet::Clear(int idx)
-{	
+{
 	mBits[idx / 32] &= ~(1 << (idx % 32));
 }
 
 //////////////////////////////////////////////////////////////////////////
 
 BfAstAllocator::BfAstAllocator()
-{	
+{
 	mSourceData = NULL;
-	mCurPtr = NULL;	
-	mCurPageEnd = mCurPtr;	
+	mCurPtr = NULL;
+	mCurPageEnd = mCurPtr;
 	mLargeAllocSizes = 0;
-	mNumPagesUsed = 0;	
+	mNumPagesUsed = 0;
 	mUsedSize = 0;
 }
 
 BfAstAllocator::~BfAstAllocator()
-{	
+{
 	for (auto addr : mLargeAllocs)
 		delete [] (uint8*)addr;
 	if (mPages.size() != 0)
@@ -61,16 +60,16 @@ BfAstAllocator::~BfAstAllocator()
 }
 
 void BfAstAllocator::InitChunkHead(int wantSize)
-{		
+{
 	mCurPtr = mSourceData->mAstAllocManager->AllocPage();
 	mPages.push_back(mCurPtr);
 	mCurPageEnd = mCurPtr + BfAstAllocManager::PAGE_SIZE;
 	mNumPagesUsed++;
-#ifdef BF_AST_ALLOCATOR_USE_PAGES	
+#ifdef BF_AST_ALLOCATOR_USE_PAGES
 	BfAstPageHeader* pageHeader = (BfAstPageHeader*)mCurPtr;
 	pageHeader->mSourceData = mSourceData;
 	BF_ASSERT(sizeof(BfAstPageHeader) <= 16);
-	mCurPtr += 16;		
+	mCurPtr += 16;
 #endif
 }
 
@@ -95,28 +94,28 @@ BfAstAllocManager::~BfAstAllocManager()
 #endif
 }
 
-//TODO: Remove this 
+//TODO: Remove this
 //static int gAstChunkAllocCount = 0;
 uint8* BfAstAllocManager::AllocPage()
 {
 #ifdef BF_AST_ALLOCATOR_USE_PAGES
 	AutoCrit autoCrit(mCritSect);
 
-	if (mFreePageCount != 0)	
+	if (mFreePageCount != 0)
 	{
 		mFreePageCount--;
 		return (uint8*)mFreePages.PopFront();
 	}
-	
+
 	BF_ASSERT(mFreePages.mHead == NULL);
-	
+
 	//auto newChunk = (uint8*)::VirtualAlloc((void*)(0x4200000000 + gAstChunkAllocCount*CHUNK_SIZE), CHUNK_SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
 	//gAstChunkAllocCount++;
 
 	auto newChunk = (uint8*)::VirtualAlloc(NULL, CHUNK_SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
 	BF_ASSERT(newChunk != NULL);
-	BF_ASSERT(((intptr)newChunk & (PAGE_SIZE - 1)) == 0);	
-	mAllocChunks.push_back(newChunk);	
+	BF_ASSERT(((intptr)newChunk & (PAGE_SIZE - 1)) == 0);
+	mAllocChunks.push_back(newChunk);
 
 	//BfLog("BfAstAllocManager alloc %p\n", newChunk);
 
@@ -128,7 +127,7 @@ uint8* BfAstAllocManager::AllocPage()
 	}
 
 	mFreePageCount--;
-	return (uint8*)mFreePages.PopFront();	
+	return (uint8*)mFreePages.PopFront();
 #else
 	return new uint8[PAGE_SIZE];
 #endif

+ 17 - 20
IDEHelper/Compiler/BfAstAllocator.h

@@ -49,14 +49,13 @@ public:
 class BfAstPageHeader
 {
 public:
-	BfSourceData* mSourceData;	
+	BfSourceData* mSourceData;
 };
 #endif
 
 class BfAstAllocChunk;
 class BfAstAllocManager;
 
-
 struct BfAstFreePage
 {
 	BfAstFreePage* mNext;
@@ -75,7 +74,7 @@ public:
 	Array<uint8*> mAllocChunks;
 #endif
 
-public:	
+public:
 	BfAstAllocManager();
 	~BfAstAllocManager();
 
@@ -90,7 +89,7 @@ public:
 // {
 // 	int mCount;
 // 	int mSize;
-// 
+//
 // 	BumpAllocTrackedEntry()
 // 	{
 // 		mCount = 0;
@@ -103,9 +102,9 @@ class BfAstAllocator
 {
 public:
 	static const int LARGE_ALLOC_SIZE = 2048;
-	BfSourceData* mSourceData;		
-	uint8* mCurPtr;	
-	uint8* mCurPageEnd;	
+	BfSourceData* mSourceData;
+	uint8* mCurPtr;
+	uint8* mCurPageEnd;
 	Array<void*> mLargeAllocs;
 	Array<uint8*> mPages;
 	int mLargeAllocSizes;
@@ -117,8 +116,8 @@ public:
 
 public:
 	BfAstAllocator();
-	~BfAstAllocator();	
-	
+	~BfAstAllocator();
+
 	void InitChunkHead(int wantSize);
 
 	int GetAllocSize() const
@@ -141,7 +140,7 @@ public:
 	{
 		int alignSize = alignof(T);
 		mCurPtr = (uint8*)(((intptr)mCurPtr + alignSize - 1) & ~(alignSize - 1));
-		int wantSize = sizeof(T) + extraBytes;		
+		int wantSize = sizeof(T) + extraBytes;
 
 #ifdef BUMPALLOC_TRACKALLOCS
 		const char* name = typeid(T).name();
@@ -152,10 +151,10 @@ public:
 #endif
 
 		if (mCurPtr + wantSize >= mCurPageEnd)
-			InitChunkHead(wantSize);		
+			InitChunkHead(wantSize);
 		memset(mCurPtr, 0, wantSize);
-		T* retVal = new (mCurPtr) T();		
-		mCurPtr += wantSize;		
+		T* retVal = new (mCurPtr) T();
+		mCurPtr += wantSize;
 
 #ifndef BF_AST_ALLOCATOR_USE_PAGES
 		retVal->mSourceData = this->mSourceData;
@@ -165,8 +164,8 @@ public:
 	}
 
 	uint8* AllocBytes(int wantSize, int alignSize, const char* dbgName = "AllocBytes")
-	{	
-#ifdef BUMPALLOC_TRACKALLOCS		
+	{
+#ifdef BUMPALLOC_TRACKALLOCS
 		BumpAllocTrackedEntry* allocSizePtr;
 		mTrackedAllocs.TryAdd(dbgName, NULL, &allocSizePtr);
 		allocSizePtr->mCount++;
@@ -188,13 +187,13 @@ public:
 			InitChunkHead(wantSize);
 		memset(mCurPtr, 0, wantSize);
 		uint8* retVal = mCurPtr;
-		mCurPtr += wantSize;		
+		mCurPtr += wantSize;
 		return retVal;
 	}
 
 	uint8* AllocBytes(int wantSize, const char* dbgName = "AllocBytes")
 	{
-#ifdef BUMPALLOC_TRACKALLOCS		
+#ifdef BUMPALLOC_TRACKALLOCS
 		BumpAllocTrackedEntry* allocSizePtr;
 		mTrackedAllocs.TryAdd(dbgName, NULL, &allocSizePtr);
 		allocSizePtr->mCount++;
@@ -211,12 +210,10 @@ public:
 		if (mCurPtr + wantSize >= mCurPageEnd)
 			InitChunkHead(wantSize);
 		memset(mCurPtr, 0, wantSize);
-		uint8* retVal = mCurPtr;	
+		uint8* retVal = mCurPtr;
 		mCurPtr += wantSize;
 		return retVal;
 	}
 };
 
 NS_BF_END
-
-

File diff ditekan karena terlalu besar
+ 132 - 136
IDEHelper/Compiler/BfAutoComplete.cpp


+ 33 - 33
IDEHelper/Compiler/BfAutoComplete.h

@@ -62,7 +62,7 @@ public:
 	}
 
 	bool operator==(const AutoCompleteEntry& other) const
-	{	
+	{
 		return strcmp(mDisplay, other.mDisplay) == 0;
 	}
 };
@@ -73,7 +73,7 @@ template <>
 struct BeefHash<Beefy::AutoCompleteEntry>
 {
 	size_t operator()(const Beefy::AutoCompleteEntry& val)
-	{		
+	{
 		intptr hash = 0;
 		const char* curPtr = val.mDisplay;
 		while (true)
@@ -92,7 +92,7 @@ NS_BF_BEGIN
 
 class AutoCompleteBase
 {
-public:	
+public:
 	class EntryLess
 	{
 	public:
@@ -103,7 +103,7 @@ public:
 				result = strcmp(left.mDisplay, right.mDisplay);
 			return result < 0;
 		}
-	};	
+	};
 
 public:
 	BumpAllocator mAlloc;
@@ -128,13 +128,13 @@ public:
 
 class BfAutoComplete : public AutoCompleteBase
 {
-public:	
+public:
 	class MethodMatchEntry
 	{
-	public:		
+	public:
 		BfMethodDef* mMethodDef;
 		BfFieldInstance* mPayloadEnumField;
-		BfTypeInstance* mTypeInstance;		
+		BfTypeInstance* mTypeInstance;
 		BfTypeVector mGenericArguments;
 		BfMethodInstance* mCurMethodInstance;
 
@@ -142,34 +142,34 @@ public:
 		{
 			mMethodDef = NULL;
 			mPayloadEnumField = NULL;
-			mTypeInstance = NULL;			
+			mTypeInstance = NULL;
 			mCurMethodInstance = NULL;
 		}
 	};
 
 	class MethodMatchInfo
 	{
-	public:		
+	public:
 		BfTypeInstance* mCurTypeInstance;
 		BfMethodInstance* mCurMethodInstance;
 		Array<MethodMatchEntry> mInstanceList;
 		int mInvocationSrcIdx;
-		int mBestIdx;		
-		int mPrevBestIdx;		
+		int mBestIdx;
+		int mPrevBestIdx;
 		bool mHadExactMatch;
-		int mMostParamsMatched;		
+		int mMostParamsMatched;
 		Array<int> mSrcPositions; // start, commas, end
-		
+
 	public:
 		MethodMatchInfo()
 		{
 			mInvocationSrcIdx = -1;
 			mCurTypeInstance = NULL;
 			mCurMethodInstance = NULL;
-			mBestIdx = 0;			
-			mPrevBestIdx = -1;			
+			mBestIdx = 0;
+			mPrevBestIdx = -1;
 			mHadExactMatch = false;
-			mMostParamsMatched = 0;			
+			mMostParamsMatched = 0;
 		}
 
 		~MethodMatchInfo()
@@ -177,10 +177,10 @@ public:
 		}
 	};
 
-public:	
+public:
 	BfModule* mModule;
 	BfCompiler* mCompiler;
-	BfSystem* mSystem;	
+	BfSystem* mSystem;
 	MethodMatchInfo* mMethodMatchInfo;
 	bool mIsCapturingMethodMatchInfo;
 	String mDefaultSelection;
@@ -196,8 +196,8 @@ public:
 	bool mForceAllowNonStatic;
 	int mCursorLineStart;
 	int mCursorLineEnd;
-	
-	int mReplaceLocalId;	
+
+	int mReplaceLocalId;
 	BfMethodDef* mDefMethod;
 	BfTypeDef* mDefType;
 	BfFieldDef* mDefField;
@@ -206,7 +206,7 @@ public:
 	int mDefMethodGenericParamIdx;
 	int mDefTypeGenericParamIdx;
 
-public:	
+public:
 	BfProject* GetActiveProject();
 	bool WantsEntries();
 	bool CheckProtection(BfProtection protection, BfTypeDef* typeDef, bool allowProtected, bool allowPrivate);
@@ -216,9 +216,9 @@ public:
 	bool IsAutocompleteNode(BfAstNode* node, int lengthAdd = 0, int startAdd = 0);
 	bool IsAutocompleteNode(BfAstNode* startNode, BfAstNode* endNode, int lengthAdd = 0, int startAdd = 0);
 	bool IsAutocompleteLineNode(BfAstNode* node);
-	BfTypedValue LookupTypeRefOrIdentifier(BfAstNode* node, bool* isStatic, BfEvalExprFlags evalExprFlags = BfEvalExprFlags_None, BfType* expectingType = NULL);	
+	BfTypedValue LookupTypeRefOrIdentifier(BfAstNode* node, bool* isStatic, BfEvalExprFlags evalExprFlags = BfEvalExprFlags_None, BfType* expectingType = NULL);
 	void SetDefinitionLocation(BfAstNode* astNode, bool force = false);
-	bool IsAttribute(BfTypeInstance* typeInst);	
+	bool IsAttribute(BfTypeInstance* typeInst);
 	void AddMethod(BfTypeInstance* typeInstance, BfMethodDef* methodDef, BfMethodInstance* methodInstance, BfMethodDeclaration* methodDecl, const StringImpl& methodName, const StringImpl& filter);
 	void AddField(BfTypeInstance* typeInst, BfFieldDef* fieldDef, BfFieldInstance* fieldInstance, const StringImpl& filter);
 	void AddProp(BfTypeInstance* typeInst, BfPropertyDef* propDef, const StringImpl& filter);
@@ -228,26 +228,26 @@ public:
 	void AddTypeMembers(BfTypeInstance* typeInst, bool addStatic, bool addNonStatic, const StringImpl& filter, BfTypeInstance* startType, bool allowInterfaces, bool allowImplicitThis, bool checkOuterType);
 	void AddSelfResultTypeMembers(BfTypeInstance* typeInst, BfTypeInstance* selfType, const StringImpl& filter, bool allowPrivate);
 	bool InitAutocomplete(BfAstNode* dotNode, BfAstNode* nameNode, String& filter);
-	void AddEnumTypeMembers(BfTypeInstance* typeInst, const StringImpl& filter, bool allowProtected, bool allowPrivate);	
+	void AddEnumTypeMembers(BfTypeInstance* typeInst, const StringImpl& filter, bool allowProtected, bool allowPrivate);
 	void AddExtensionMethods(BfTypeInstance* targetType, BfTypeInstance* extensionContainer, const StringImpl& filter, bool allowProtected, bool allowPrivate);
 	void AddTopLevelNamespaces(BfAstNode* identifierNode);
 	void AddTopLevelTypes(BfAstNode* identifierNode, bool onlyAttribute = false);
 	void AddOverrides(const StringImpl& filter);
-	void UpdateReplaceData();	
+	void UpdateReplaceData();
 	void AddTypeInstanceEntry(BfTypeInstance* typeInst);
 	bool CheckDocumentation(AutoCompleteEntry* entry, BfCommentNode* documentation);
 	bool GetMethodInfo(BfMethodInstance* methodInst, StringImpl* methodName, StringImpl* insertString, bool isImplementing, bool isExplicitInterface);
 	void FixitGetParamString(const BfTypeVector& paramTypes, StringImpl& outStr);
 	int FixitGetMemberInsertPos(BfTypeDef* typeDef);
 	String FixitGetLocation(BfParserData* parserData, int insertPos);
-	String ConstantToString(BfIRConstHolder* constHolder, BfIRValue id);	
+	String ConstantToString(BfIRConstHolder* constHolder, BfIRValue id);
 
 public:
 	BfAutoComplete(BfResolveType resolveType = BfResolveType_Autocomplete, bool doFuzzyAutoComplete = false);
 	~BfAutoComplete();
 
 	void SetModule(BfModule* module);
-	void Clear();		
+	void Clear();
 	void RemoveMethodMatchInfo();
 	void ClearMethodMatchEntries();
 
@@ -256,21 +256,21 @@ public:
 	bool CheckExplicitInterface(BfTypeInstance* interfaceType, BfAstNode* dotToken, BfAstNode* memberName);
 	void CheckTypeRef(BfTypeReference* typeRef, bool mayBeIdentifier, bool isInExpression = false, bool onlyAttribute = false);
 	void CheckAttributeTypeRef(BfTypeReference* typeRef);
-	void CheckInvocation(BfAstNode* invocationNode, BfTokenNode* openParen, BfTokenNode* closeParen, const BfSizedArray<BfTokenNode*>& commas);	
+	void CheckInvocation(BfAstNode* invocationNode, BfTokenNode* openParen, BfTokenNode* closeParen, const BfSizedArray<BfTokenNode*>& commas);
 	void CheckNode(BfAstNode* node, bool mayBeIdentifier, bool isInExpression = false);
 	void CheckMethod(BfMethodDeclaration* methodDeclaration, bool isLocalMethod);
-	void CheckProperty(BfPropertyDeclaration* propertyDeclaration);	
+	void CheckProperty(BfPropertyDeclaration* propertyDeclaration);
 	void CheckVarResolution(BfAstNode* varTypeRef, BfType* resolvedTypeRef);
 	void CheckResult(BfAstNode* node, const BfTypedValue& typedValue);
 	void CheckLocalDef(BfAstNode* identifierNode, BfLocalVariable* varDecl);
 	void CheckLocalRef(BfAstNode* identifierNode, BfLocalVariable* varDecl);
-	void CheckFieldRef(BfAstNode* identifierNode, BfFieldInstance* fieldInst);	
+	void CheckFieldRef(BfAstNode* identifierNode, BfFieldInstance* fieldInst);
 	void CheckLabel(BfIdentifierNode* identifierNode, BfAstNode* precedingNode, BfScopeData* scopeData);
 	void CheckNamespace(BfAstNode* node, const BfAtomComposite& namespaceName);
-	void CheckEmptyStart(BfAstNode* prevNode, BfType* type);	
-	bool CheckFixit(BfAstNode* node);	
+	void CheckEmptyStart(BfAstNode* prevNode, BfType* type);
+	bool CheckFixit(BfAstNode* node);
 	void CheckInterfaceFixit(BfTypeInstance* typeInstance, BfAstNode* node);
-	
+
 	void FixitAddMember(BfTypeInstance* typeInst, BfType* fieldType, const StringImpl& fieldName, bool isStatic, BfTypeInstance* referencedFrom);
 	void FixitAddCase(BfTypeInstance * typeInst, const StringImpl & caseName, const BfTypeVector & fieldTypes);
 	void FixitAddMethod(BfTypeInstance* typeInst, const StringImpl& methodName, BfType* returnType, const BfTypeVector& paramTypes, bool wantStatic);

+ 88 - 92
IDEHelper/Compiler/BfCodeGen.cpp

@@ -57,7 +57,6 @@
 USING_NS_BF;
 using namespace llvm;
 
-
 String BfCodeGenDirectoryData::GetDataFileName()
 {
 	return mDirectoryName + "/build.dat";
@@ -89,7 +88,7 @@ void BfCodeGenDirectoryData::Read()
 	for (int fileIdx = 0; fileIdx < numFiles; fileIdx++)
 	{
 		String fileName = fileStream.ReadAscii32SizedString();
-		BfCodeGenFileData fileData;		
+		BfCodeGenFileData fileData;
 		fileStream.Read(&fileData.mIRHash, sizeof(Val128));
 		fileStream.Read(&fileData.mIROrderedHash, sizeof(Val128));
 		fileStream.Read(&fileData.mLastWasObjectWrite, sizeof(bool));
@@ -159,7 +158,7 @@ void BfCodeGenDirectoryData::Write()
 }
 
 void BfCodeGenDirectoryData::Verify()
-{	
+{
 	if (!mError.empty())
 		return;
 
@@ -171,12 +170,12 @@ void BfCodeGenDirectoryData::Verify()
 	}
 	else
 	{
-		mError = "Build directory corrupted, perform clean";		
-	}	
+		mError = "Build directory corrupted, perform clean";
+	}
 }
 
 void BfCodeGenDirectoryData::Clear()
-{	
+{
 	mFileMap.Clear();
 	mBuildSettings.Clear();
 }
@@ -187,16 +186,16 @@ bool BfCodeGenDirectoryData::CheckCache(const StringImpl& fileName, Val128 hash,
 		Verify();
 
 	BfCodeGenFileData* fileData = NULL;
-	
+
 	if (!mFileMap.TryAdd(fileName, NULL, &fileData))
-	{	
+	{
 		if ((fileData->mLastWasObjectWrite) && (disallowObjectWrite))
 			return false;
 		if (outOrderedHash != NULL)
 			*outOrderedHash = fileData->mIROrderedHash;
-		if (fileData->mIRHash == hash)								
-			return true;		
-		fileData->mIRHash = hash;		
+		if (fileData->mIRHash == hash)
+			return true;
+		fileData->mIRHash = hash;
 		return false;
 	}
 
@@ -212,9 +211,9 @@ void BfCodeGenDirectoryData::SetHash(const StringImpl& fileName, Val128 hash, Va
 
 	BfCodeGenFileData* fileData = NULL;
 
-	mFileMap.TryAdd(fileName, NULL, &fileData);	
+	mFileMap.TryAdd(fileName, NULL, &fileData);
 	fileData->mIRHash = hash;
-	fileData->mIROrderedHash = orderedHash;	
+	fileData->mIROrderedHash = orderedHash;
 	fileData->mLastWasObjectWrite = isObjectWrite;
 }
 
@@ -223,7 +222,6 @@ void BfCodeGenDirectoryData::ClearHash(const StringImpl& fileName)
 	mFileMap.Remove(fileName);
 }
 
-
 void BfCodeGenDirectoryData::FileFailed()
 {
 	mFileFailed = true;
@@ -240,7 +238,7 @@ String BfCodeGenDirectoryData::GetValue(const StringImpl& key)
 }
 
 void BfCodeGenDirectoryData::SetValue(const StringImpl& key, const StringImpl& value)
-{	
+{
 	mBuildSettings[key] = value;
 }
 
@@ -265,16 +263,16 @@ void DbgSaveData(BfCodeGenRequest* genRequest)
 //////////////////////////////////////////////////////////////////////////
 
 BfCodeGenThread::BfCodeGenThread()
-{	
+{
 	mShuttingDown = false;
-	mRunning = false;		
+	mRunning = false;
 	mThreadIdx = 0;
 	mCodeGen = NULL;
 }
 
 BfCodeGenThread::~BfCodeGenThread()
 {
-	Shutdown();		
+	Shutdown();
 }
 
 void BfCodeGenThread::RunLoop()
@@ -282,21 +280,21 @@ void BfCodeGenThread::RunLoop()
 	String threadName = StrFormat("CodeGen/Worker %d", mThreadIdx);
 	BpSetThreadName(threadName.c_str());
 	BfpThread_SetName(NULL, threadName.c_str(), NULL);
-		
+
 	while (!mShuttingDown)
-	{				
+	{
 		BfCodeGenRequest* request = NULL;
 		{
 			AutoCrit autoCrit(mCodeGen->mPendingRequestCritSect);
 			if (!mCodeGen->mPendingRequests.IsEmpty())
 			{
 				request = mCodeGen->mPendingRequests[0];
-				mCodeGen->mPendingRequests.RemoveAt(0);				
+				mCodeGen->mPendingRequests.RemoveAt(0);
 			}
 		}
 
 		if (request == NULL)
-		{			
+		{
 			mCodeGen->mRequestEvent.WaitFor(20);
 			continue;
 		}
@@ -318,7 +316,7 @@ void BfCodeGenThread::RunLoop()
 
 #ifndef CODEGEN_DISABLE_CACHE
 		{
-			AutoCrit autoCrit(mCodeGen->mCacheCritSect);						
+			AutoCrit autoCrit(mCodeGen->mCacheCritSect);
 			dirCache = mCodeGen->GetDirCache(cacheDir);
 
 			//For testing only!
@@ -328,11 +326,11 @@ void BfCodeGenThread::RunLoop()
 				fileStr.Write(request->mData.mVals, request->mData.mSize);
 			}*/
 
-			HashContext hashCtx;						
+			HashContext hashCtx;
 			hashCtx.Mixin(request->mOptions.mHash);
-			hashCtx.Mixin(request->mData.mVals, request->mData.mSize);			
+			hashCtx.Mixin(request->mData.mVals, request->mData.mSize);
 			hash = hashCtx.Finish128();
-						
+
 			hasCacheMatch = dirCache->CheckCache(cacheFileName, hash, &orderedHash, isLibWrite);
 
 #ifdef BF_PLATFORM_WINDOWS
@@ -346,10 +344,9 @@ void BfCodeGenThread::RunLoop()
 					hash = Val128();
 					hasCacheMatch = false;
 				}
-			}			
+			}
 
 #endif
-
 		}
 #endif
 
@@ -360,7 +357,7 @@ void BfCodeGenThread::RunLoop()
 			hasCacheMatch = false;
 #endif
 
-		String errorMsg;		
+		String errorMsg;
 
 		bool doBEProcessing = true; // TODO: Normally 'true' so we do ordered cache check for LLVM too
 		if (request->mOptions.mOptLevel == BfOptLevel_OgPlus)
@@ -375,7 +372,7 @@ void BfCodeGenThread::RunLoop()
 		}
 		else
 		{
-#ifdef BF_PLATFORM_WINDOWS			
+#ifdef BF_PLATFORM_WINDOWS
 			BeIRCodeGen* beIRCodeGen = new BeIRCodeGen();
 			defer ( delete beIRCodeGen; );
 
@@ -383,17 +380,17 @@ void BfCodeGenThread::RunLoop()
 			beIRCodeGen->SetConfigConst(BfIRConfigConst_DynSlotOfs, request->mOptions.mDynSlotOfs);
 
 			if (doBEProcessing)
-			{				
-				BP_ZONE("ProcessBfIRData");			
+			{
+				BP_ZONE("ProcessBfIRData");
 				beIRCodeGen->Init(request->mData);
 
 				BeHashContext hashCtx;
 				hashCtx.Mixin(request->mOptions.mHash);
-				beIRCodeGen->Hash(hashCtx);				
+				beIRCodeGen->Hash(hashCtx);
 				auto newOrderedHash = hashCtx.Finish128();
 				BfLogX(2, "Ordered hash for %s New:%s Old:%s\n", cacheFileName.c_str(), newOrderedHash.ToString().c_str(), orderedHash.ToString().c_str());
 				hasCacheMatch = newOrderedHash == orderedHash;
-				
+
 				errorMsg = beIRCodeGen->mErrorMsg;
 				orderedHash = newOrderedHash;
 			}
@@ -402,10 +399,10 @@ void BfCodeGenThread::RunLoop()
 			{
 				result.mType = BfCodeGenResult_DoneCached;
 			}
-			
+
 #ifndef CODEGEN_DISABLE_CACHE
 			{
-				AutoCrit autoCrit(mCodeGen->mCacheCritSect);								
+				AutoCrit autoCrit(mCodeGen->mCacheCritSect);
 				dirCache->SetHash(cacheFileName, hash, orderedHash, !isLibWrite);
 			}
 #endif
@@ -416,7 +413,7 @@ void BfCodeGenThread::RunLoop()
 				//
 			}
 			else if (request->mOptions.mOptLevel == BfOptLevel_OgPlus)
-			{				
+			{
 #ifdef BF_PLATFORM_WINDOWS
 				BP_ZONE("BfCodeGen::RunLoop.Beef");
 
@@ -432,7 +429,7 @@ void BfCodeGenThread::RunLoop()
 					{
 						if (!errorMsg.empty())
 							errorMsg += "\n";
-						errorMsg += "Failed writing IR '" + fileName + "': " + ec.message();						
+						errorMsg += "Failed writing IR '" + fileName + "': " + ec.message();
 					}
 					else
 						fs.WriteSNZ(str);
@@ -445,9 +442,9 @@ void BfCodeGenThread::RunLoop()
 				BfLogX(2, "Generating obj %s\n", request->mOutFileName.c_str());
 
 				BeCOFFObject coffObject;
-				coffObject.mWriteToLib = request->mOptions.mWriteToLib;				
+				coffObject.mWriteToLib = request->mOptions.mWriteToLib;
 				if (!coffObject.Generate(beIRCodeGen->mBeModule, objFileName))
-					errorMsg = StrFormat("Failed to write object file: %s", objFileName.c_str());				
+					errorMsg = StrFormat("Failed to write object file: %s", objFileName.c_str());
 
 				if (!beIRCodeGen->mErrorMsg.IsEmpty())
 				{
@@ -467,14 +464,14 @@ void BfCodeGenThread::RunLoop()
 				BfIRCodeGen* llvmIRCodeGen = new BfIRCodeGen();
 				llvmIRCodeGen->SetCodeGenOptions(request->mOptions);
 				llvmIRCodeGen->SetConfigConst(BfIRConfigConst_VirtualMethodOfs, request->mOptions.mVirtualMethodOfs);
-				llvmIRCodeGen->SetConfigConst(BfIRConfigConst_DynSlotOfs, request->mOptions.mDynSlotOfs);				
+				llvmIRCodeGen->SetConfigConst(BfIRConfigConst_DynSlotOfs, request->mOptions.mDynSlotOfs);
 				llvmIRCodeGen->ProcessBfIRData(request->mData);
-								
+
 				errorMsg = llvmIRCodeGen->mErrorMsg;
 				llvmIRCodeGen->mErrorMsg.Clear();
 
 				if (errorMsg.IsEmpty())
-				{					
+				{
 					if (request->mOptions.mWriteLLVMIR)
 					{
 						BP_ZONE("BfCodeGen::RunLoop.LLVM.IR");
@@ -503,16 +500,16 @@ void BfCodeGenThread::RunLoop()
 							result.mType = BfCodeGenResult_Failed;
 							dirCache->FileFailed();
 						}
-					}					
+					}
 				}
-								
+
 				if (!llvmIRCodeGen->mErrorMsg.IsEmpty())
 				{
 					if (!errorMsg.IsEmpty())
 						errorMsg += "\n";
 					errorMsg += llvmIRCodeGen->mErrorMsg;
 				}
-				
+
 				delete llvmIRCodeGen;
 			}
 		}
@@ -538,9 +535,9 @@ void BfCodeGenThread::RunLoop()
 			// It's an extern request, so we own this
 			bool deleteRequest = false;
 			if (request->mExternResultPtr != NULL)
-			{					
+			{
 				*request->mExternResultPtr = result;
-				deleteRequest = true;					
+				deleteRequest = true;
 			}
 
 			// We need this fence for BF_USE_CODEGEN_RELEASE_THUNK usage- because we can't access the request anymore after setting
@@ -549,21 +546,21 @@ void BfCodeGenThread::RunLoop()
 
 			AutoCrit autoCrit(mCodeGen->mPendingRequestCritSect);
 			request->mResult = result;
-			mCodeGen->mDoneEvent.Set();				
+			mCodeGen->mDoneEvent.Set();
 			if (deleteRequest)
 				delete request;
-		}				
+		}
 	}
 
 	mRunning = false;
-	mCodeGen->mDoneEvent.Set();	
+	mCodeGen->mDoneEvent.Set();
 }
 
 void BfCodeGenThread::Shutdown()
 {
 	mShuttingDown = true;
 	if (mRunning)
-		mCodeGen->mRequestEvent.Set(true);	
+		mCodeGen->mRequestEvent.Set(true);
 
 	while (mRunning)
 	{
@@ -580,11 +577,11 @@ static void BFP_CALLTYPE RunLoopThunk(void* codeGenThreadP)
 
 void BfCodeGenThread::Start()
 {
-	mRunning = true;	
+	mRunning = true;
 	//TODO: How much mem do we need? WTF- we have 32MB set before!
 	auto mThread = BfpThread_Create(RunLoopThunk, (void*)this, 1024 * 1024, BfpThreadCreateFlag_StackSizeReserve);
 	BfpThread_SetPriority(mThread, BfpThreadPriority_Low, NULL);
-	BfpThread_Release(mThread);	
+	BfpThread_Release(mThread);
 }
 
 //////////////////////////////////////////////////////////////////////////
@@ -592,7 +589,7 @@ void BfCodeGenThread::Start()
 BfCodeGen::BfCodeGen()
 {
 	mAttemptedReleaseThunkLoad = false;
-	mIsUsingReleaseThunk = false;	
+	mIsUsingReleaseThunk = false;
 	mReleaseModule = NULL;
 	mClearCacheFunc = NULL;
 	mGetVersionFunc = NULL;
@@ -600,10 +597,10 @@ BfCodeGen::BfCodeGen()
 	mCancelFunc = NULL;
 	mFinishFunc = NULL;
 	mGenerateObjFunc = NULL;
-	
+
 	mRequestIdx = 0;
 #ifdef MAX_THREADS
-	mMaxThreadCount = MAX_THREADS;	
+	mMaxThreadCount = MAX_THREADS;
 #else
 	mMaxThreadCount = 6;
 #endif
@@ -703,7 +700,7 @@ void BfCodeGen::UpdateStats()
 		auto request = mRequests[0];
 		if (request->mResult.mType == BfCodeGenResult_NotDone)
 			return;
-		
+
 		RequestComplete(request);
 		delete request;
 		mRequests.RemoveAt(0);
@@ -732,7 +729,7 @@ void BfCodeGen::ClearBuildCache()
 	for (auto& dirCachePair : mDirectoryCache)
 	{
 		auto dirData = dirCachePair.mValue;
-		dirData->Clear();		
+		dirData->Clear();
 	}
 	// This just disables reading the cache file, but it does not disable creating
 	//  the cache structes in memory and writing them out, thus it's valid to leave
@@ -747,9 +744,9 @@ void BfCodeGen::ClearBuildCache()
 }
 
 void BfCodeGen::DoWriteObjectFile(BfCodeGenRequest* codeGenRequest, const void* ptr, int size, const StringImpl& outFileName, BfCodeGenResult* externResultPtr)
-{	
+{
 	codeGenRequest->mData.mVals = (uint8*)ptr;
-	codeGenRequest->mData.mSize = size;	
+	codeGenRequest->mData.mSize = size;
 	codeGenRequest->mOutFileName = outFileName;
 	codeGenRequest->mResult.mType = BfCodeGenResult_NotDone;
 	codeGenRequest->mResult.mErrorMsgBufLen = 0;
@@ -769,11 +766,11 @@ void BfCodeGen::DoWriteObjectFile(BfCodeGenRequest* codeGenRequest, const void*
 	auto thread = mThreads[threadIdx];
 
 	BP_ZONE("WriteObjectFile_CritSect");
-	AutoCrit autoCrit(mPendingRequestCritSect);	
+	AutoCrit autoCrit(mPendingRequestCritSect);
 	mPendingRequests.push_back(codeGenRequest);
 
 #ifdef BF_PLATFORM_WINDOWS
-	BF_ASSERT(!mRequestEvent.mEvent->mManualReset); // Make sure it's out of the SignalAll state	
+	BF_ASSERT(!mRequestEvent.mEvent->mManualReset); // Make sure it's out of the SignalAll state
 #endif
 	mRequestEvent.Set();
 
@@ -843,11 +840,11 @@ bool BfCodeGen::ExternWriteObjectFile(BfCodeGenRequest* codeGenRequest)
 #ifndef BF_USE_CODEGEN_RELEASE_THUNK
 	return false;
 #endif
-	
+
 	BindReleaseThunks();
 
 	if (!mIsUsingReleaseThunk)
-		return false;	
+		return false;
 
 	mGenerateObjFunc(codeGenRequest->mData.mVals, codeGenRequest->mData.mSize, codeGenRequest->mOutFileName.c_str(), &codeGenRequest->mResult, codeGenRequest->mOptions);
 
@@ -855,15 +852,15 @@ bool BfCodeGen::ExternWriteObjectFile(BfCodeGenRequest* codeGenRequest)
 }
 
 void BfCodeGen::WriteObjectFile(BfModule* bfModule, const StringImpl& outFileName, const BfCodeGenOptions& options)
-{		
+{
 	mQueuedCount++;
-	
+
 	BfLogSys(bfModule->mSystem, "WriteObjectFile %s\n", outFileName.c_str());
 
-	BfCodeGenRequest* codeGenRequest = new BfCodeGenRequest();	
+	BfCodeGenRequest* codeGenRequest = new BfCodeGenRequest();
 	mRequests.push_back(codeGenRequest);
-	
-	{			
+
+	{
 		BP_ZONE("WriteObjectFile_GetBufferData");
 		bfModule->mBfIRBuilder->GetBufferData(codeGenRequest->mOutBuffer);
 	}
@@ -873,13 +870,13 @@ void BfCodeGen::WriteObjectFile(BfModule* bfModule, const StringImpl& outFileNam
 		rootModule = rootModule->mParentModule;
 
 	codeGenRequest->mSrcModule = rootModule;
-	codeGenRequest->mOutFileName = outFileName;	
-	codeGenRequest->mData = codeGenRequest->mOutBuffer;	
+	codeGenRequest->mOutFileName = outFileName;
+	codeGenRequest->mData = codeGenRequest->mOutBuffer;
 	codeGenRequest->mOptions = options;
 	if (ExternWriteObjectFile(codeGenRequest))
-		return;	
+		return;
 
-	DoWriteObjectFile(codeGenRequest, (void*)&codeGenRequest->mOutBuffer[0], (int)codeGenRequest->mOutBuffer.size(), codeGenRequest->mOutFileName, NULL);		
+	DoWriteObjectFile(codeGenRequest, (void*)&codeGenRequest->mOutBuffer[0], (int)codeGenRequest->mOutBuffer.size(), codeGenRequest->mOutFileName, NULL);
 
 #ifdef DBG_FORCE_SYNCHRONIZED
 	while (mRequests.size() != 0)
@@ -918,7 +915,7 @@ void BfCodeGen::RequestComplete(BfCodeGenRequest* request)
 	if ((request->mResult.mType == BfCodeGenResult_Failed) || (request->mResult.mType == BfCodeGenResult_Aborted))
 	{
 		BfCodeGenErrorEntry errorEntry;
-		errorEntry.mSrcModule = request->mSrcModule;		
+		errorEntry.mSrcModule = request->mSrcModule;
 		errorEntry.mOutFileName = request->mOutFileName;
 
 		int errorPos = 0;
@@ -928,7 +925,7 @@ void BfCodeGen::RequestComplete(BfCodeGenRequest* request)
 			errorEntry.mErrorMessages.push_back(errorStr);
 			errorPos += (int)strlen(errorStr) + 1;
 		}
-		
+
 		mFailedRequests.push_back(errorEntry);
 	}
 	else
@@ -970,7 +967,7 @@ void BfCodeGen::ProcessErrors(BfPassInstance* passInstance, bool canceled)
 			{
 				passInstance->Fail(dirEntry->mError);
 				showedCacheError = true;
-			}			
+			}
 			dirEntry->mError.clear();
 		}
 	}
@@ -1000,7 +997,7 @@ void BfCodeGen::Cancel()
 {
 	for (auto thread : mThreads)
 	{
-		thread->mShuttingDown = true;		
+		thread->mShuttingDown = true;
 	}
 
 	mRequestEvent.Set(true);
@@ -1016,9 +1013,9 @@ void BfCodeGen::ClearResults()
 }
 
 bool BfCodeGen::Finish()
-{	
+{
 	BP_ZONE("BfCodeGen::Finish");
-		
+
 	while (mRequests.size() != 0)
 	{
 		auto request = mRequests[0];
@@ -1047,7 +1044,7 @@ bool BfCodeGen::Finish()
 		return false;
 	}
 
-	if (mIsUsingReleaseThunk)	
+	if (mIsUsingReleaseThunk)
 	{
 		// Make the thunk release its threads (and more important, its LLVM contexts)
 		mFinishFunc();
@@ -1056,14 +1053,14 @@ bool BfCodeGen::Finish()
 	// We need to shut down these threads to remove their memory
 	for (auto thread : mThreads)
 	{
-		thread->mShuttingDown = true;		
-		mOldThreads.push_back(thread);		
+		thread->mShuttingDown = true;
+		mOldThreads.push_back(thread);
 	}
 	mThreads.Clear();
 	mRequestEvent.Set(true);
 
 	ClearOldThreads(false);
-		
+
 // 	for (auto request : mPendingRequests)
 // 	{
 // 		if (request->mExternResultPtr != NULL)
@@ -1073,7 +1070,7 @@ bool BfCodeGen::Finish()
 // 		}
 // 		//request->mResult.mType = BfCodeGenResult_Aborted;
 // 		//delete request;
-// 	}	
+// 	}
 // 	mPendingRequests.Clear();
 
 	///
@@ -1113,8 +1110,8 @@ BF_EXPORT int BF_CALLTYPE BfCodeGen_GetVersion()
 
 BF_EXPORT void BF_CALLTYPE BfCodeGen_ClearCache()
 {
-	GetExternCodeGen();	
-	gExternCodeGen->ClearBuildCache();	
+	GetExternCodeGen();
+	gExternCodeGen->ClearBuildCache();
 }
 
 BF_EXPORT void BF_CALLTYPE BfCodeGen_Finish()
@@ -1129,7 +1126,7 @@ BF_EXPORT void BF_CALLTYPE BfCodeGen_Finish()
 BF_EXPORT void BF_CALLTYPE BfCodeGen_Kill()
 {
 	delete gExternCodeGen;
-	gExternCodeGen = NULL;	
+	gExternCodeGen = NULL;
 	Targets_Delete();
 }
 
@@ -1140,11 +1137,10 @@ BF_EXPORT void BF_CALLTYPE BfCodeGen_Cancel()
 }
 
 BF_EXPORT void BF_CALLTYPE BfCodeGen_GenerateObj(const void* ptr, int size, const char* outFileName, BfCodeGenResult* resultPtr, const BfCodeGenOptions& options)
-{	
+{
 	GetExternCodeGen();
 
-	BfCodeGenRequest* codeGenRequest = new BfCodeGenRequest();	
+	BfCodeGenRequest* codeGenRequest = new BfCodeGenRequest();
 	codeGenRequest->mOptions = options;
 	gExternCodeGen->DoWriteObjectFile(codeGenRequest, ptr, size, outFileName, resultPtr);
-}
-
+}

+ 22 - 23
IDEHelper/Compiler/BfCodeGen.h

@@ -45,16 +45,15 @@ public:
 	Array<String> mErrorMessages;
 };
 
-
 class BfCodeGenRequest
 {
-public:	
+public:
 	BfModule* mSrcModule;
 	BfCodeGenOptions mOptions;
 	BfCodeGenResult mResult;
 	Array<uint8> mOutBuffer;
 	BfSizedArray<uint8> mData;
-	String mOutFileName;	
+	String mOutFileName;
 
 	BfCodeGenResult* mExternResultPtr;
 
@@ -64,13 +63,13 @@ public:
 		mSrcModule = NULL;
 		mResult.mType = BfCodeGenResult_NotDone;
 		mResult.mErrorMsgBufLen = 0;
-		mExternResultPtr = NULL;		
+		mExternResultPtr = NULL;
 	}
 
 	~BfCodeGenRequest()
-	{				
+	{
 	}
-	
+
 	void DbgSaveData();
 };
 
@@ -78,18 +77,18 @@ class BfCodeGen;
 
 class BfCodeGenThread
 {
-public:	
-	BfCodeGen* mCodeGen;		
+public:
+	BfCodeGen* mCodeGen;
 	int mThreadIdx;
 
-	//std::vector<BfCodeGenRequest*> mRequests;	
+	//std::vector<BfCodeGenRequest*> mRequests;
 	volatile bool mShuttingDown;
 	volatile bool mRunning;
 
 public:
 	bool RawWriteObjectFile(llvm::Module* module, const StringImpl& outFileName, const BfCodeGenOptions& codeGenOptions);
-	
-public:	
+
+public:
 	BfCodeGenThread();
 	~BfCodeGenThread();
 
@@ -103,7 +102,7 @@ class BfCodeGenFileData
 {
 public:
 	Val128 mIRHash; // Equal when exact IR bits are equal
-	Val128 mIROrderedHash; // Equal when isomorphic (when alphabetically reordered functions hash equally)	
+	Val128 mIROrderedHash; // Equal when isomorphic (when alphabetically reordered functions hash equally)
 	bool mLastWasObjectWrite;
 };
 
@@ -115,7 +114,7 @@ public:
 	Dictionary<String, String> mBuildSettings;
 	String mDirectoryName;
 	bool mDirty;
-	bool mVerified;	
+	bool mVerified;
 	int64 mFileTime;
 	String mError;
 	bool mFileFailed;
@@ -163,18 +162,18 @@ public:
 	typedef void (BF_CALLTYPE* FinishFunc)();
 	typedef void (BF_CALLTYPE* GenerateObjFunc)(const void* ptr, int size, const char* outFileName, BfCodeGenResult* resultPtr, const BfCodeGenOptions& options);
 
-public:	
+public:
     BfpDynLib* mReleaseModule;
 	bool mAttemptedReleaseThunkLoad;
 	bool mIsUsingReleaseThunk;
 	ClearCacheFunc mClearCacheFunc;
 	GetVersionFunc mGetVersionFunc;
-	KillFunc mKillFunc;	
+	KillFunc mKillFunc;
 	CancelFunc mCancelFunc;
 	FinishFunc mFinishFunc;
-	GenerateObjFunc mGenerateObjFunc;	
+	GenerateObjFunc mGenerateObjFunc;
 
-	Val128 mBackendHash;	
+	Val128 mBackendHash;
 	int mMaxThreadCount;
 	CritSect mThreadsCritSect;
 	Array<BfCodeGenThread*> mThreads;
@@ -184,19 +183,19 @@ public:
 	Deque<BfCodeGenRequest*> mPendingRequests;
 	SyncEvent mRequestEvent;
 	int mRequestIdx;
-	SyncEvent mDoneEvent;	
+	SyncEvent mDoneEvent;
 
 	int mQueuedCount;
-	int mCompletionCount;	
+	int mCompletionCount;
 
 	Array<BfCodeGenErrorEntry> mFailedRequests;
 	Array<BfCodeGenFileEntry> mCodeGenFiles;
-		
+
 	CritSect mCacheCritSect;
 	bool mDisableCacheReads;
 	Dictionary<String, BfCodeGenDirectoryData*> mDirectoryCache;
 
-public:		
+public:
 	void SetMaxThreads(int maxThreads);
 	void BindReleaseThunks();
 	void ClearResults();
@@ -208,13 +207,13 @@ public:
 	void ProcessErrors(BfPassInstance* passInstance, bool canceled);
 	BfCodeGenDirectoryData* GetDirCache(const StringImpl& cacheDir);
 
-public:	
+public:
 	BfCodeGen();
 	~BfCodeGen();
 
 	void ResetStats();
 	void UpdateStats();
-	void WriteObjectFile(BfModule* module, const StringImpl& outFileName, const BfCodeGenOptions& options);	
+	void WriteObjectFile(BfModule* module, const StringImpl& outFileName, const BfCodeGenOptions& options);
 	String GetBuildValue(const StringImpl& buildDir, const StringImpl& key);
 	void SetBuildValue(const StringImpl& buildDir, const StringImpl& key, const StringImpl& value);
 	void WriteBuildCache(const StringImpl& buildDir);

File diff ditekan karena terlalu besar
+ 143 - 146
IDEHelper/Compiler/BfCompiler.cpp


+ 66 - 67
IDEHelper/Compiler/BfCompiler.h

@@ -50,7 +50,7 @@ enum BfCompileOnDemandKind
 	BfCompileOnDemandKind_SkipUnused
 };
 
-class BfCompiler 
+class BfCompiler
 {
 public:
 	enum CompileState
@@ -63,22 +63,22 @@ public:
 	};
 
 	struct Stats
-	{	
+	{
 		int mTotalTypes;
 
 		int mMethodDeclarations;
 		int mTypesPopulated;
 		int mMethodsProcessed;
-		int mUnreifiedMethodsProcessed;		
+		int mUnreifiedMethodsProcessed;
 
 		int mQueuedTypesProcessed;
 		int mTypesQueued;
 		int mTypesDeleted;
-		int mMethodsQueued;		
+		int mMethodsQueued;
 
 		int mModulesStarted;
 		int mModulesFinished;
-		
+
 		int mModulesReified;
 		int mModulesUnreified;
 
@@ -94,19 +94,19 @@ public:
 	{
 		BfProject* mHotProject;
 		int mHotCompileIdx;
-		
+
 		int32 mForceRebuildIdx;
-		BfCompileOnDemandKind mCompileOnDemandKind;		
+		BfCompileOnDemandKind mCompileOnDemandKind;
 		String mTargetTriple;
 		String mTargetCPU;
 		BfPlatformType mPlatformType;
 		BfMachineType mMachineType;
 		int mCLongSize;
 		BfToolsetType mToolsetType;
-		BfSIMDSetting mSIMDSetting;		
+		BfSIMDSetting mSIMDSetting;
 		String mMallocLinkName;
 		String mFreeLinkName;
-		bool mIncrementalBuild;		
+		bool mIncrementalBuild;
 
 		bool mEmitDebugInfo;
 		bool mEmitLineInfo;
@@ -116,15 +116,15 @@ public:
 		bool mRuntimeChecks;
 		bool mAllowStructByVal;
 		bool mEmitDynamicCastCheck;
-						
+
 		bool mAllowHotSwapping;
-		bool mObjectHasDebugFlags;		
+		bool mObjectHasDebugFlags;
 		bool mEnableRealtimeLeakCheck;
 		bool mEmitObjectAccessCheck; // Only valid with mObjectHasDebugFlags
 		bool mArithmeticChecks;
 		bool mEnableCustodian;
 		bool mEnableSideStack;
-		bool mHasVDataExtender; 
+		bool mHasVDataExtender;
 		bool mDebugAlloc;
 		bool mOmitDebugHelpers;
 
@@ -167,7 +167,7 @@ public:
 			mAllowHotSwapping = false;
 			mEmitObjectAccessCheck = false;
 			mArithmeticChecks = false;
-			mObjectHasDebugFlags = false;			
+			mObjectHasDebugFlags = false;
 			mEnableRealtimeLeakCheck = false;
 			mWriteIR = false;
 			mGenerateObj = true;
@@ -195,19 +195,19 @@ public:
 		}
 	};
 	Options mOptions;
-	
+
 	enum HotTypeFlags
 	{
 		HotTypeFlag_None		= 0,
 		HotTypeFlag_UserNotUsed = 1,
-		HotTypeFlag_UserUsed	= 2,				
-		
+		HotTypeFlag_UserUsed	= 2,
+
 		HotTypeFlag_Heap		= 4,
 		HotTypeFlag_ActiveFunction = 8, // Only set for a type version mismatch
 		HotTypeFlag_Delegate	= 0x10,    // Only set for a type version mismatch
 		HotTypeFlag_FuncPtr     = 0x20,   // Only set for a type version mismatch
 		HotTypeFlag_CanAllocate = 0x40
-	};	
+	};
 
 	enum HotResolveFlags
 	{
@@ -237,7 +237,7 @@ public:
 		Array<HotTypeFlags> mHotTypeIdFlags;
 		Array<BfHotDepData*> mReasons;
 		HashSet<BfHotMethod*> mDeferredThisCheckMethods;
-				
+
 		~HotResolveData();
 	};
 
@@ -261,7 +261,7 @@ public:
 		BfHotThisType* GetThisType(BfHotTypeVersion* hotVersion);
 		BfHotAllocation* GetAllocation(BfHotTypeVersion* hotVersion);
 		BfHotDevirtualizedMethod* GetDevirtualizedMethod(BfHotMethod* hotMethod);
-		BfHotFunctionReference* GetFunctionReference(BfHotMethod* hotMethod);		
+		BfHotFunctionReference* GetFunctionReference(BfHotMethod* hotMethod);
 		BfHotVirtualDeclaration* GetVirtualDeclaration(BfHotMethod* hotMethod);
 		BfHotInnerMethod* GetInnerMethod(BfHotMethod* hotMethod);
 	};
@@ -270,10 +270,10 @@ public:
 	{
 	public:
 		BfProject* mHotProject;
-		int mLastStringId;		
+		int mLastStringId;
 		int mCommittedHotCompileIdx;
 		bool mHasNewTypes;
-		bool mHasNewInterfaceTypes;		
+		bool mHasNewInterfaceTypes;
 		Array<BfCodeGenFileEntry> mQueuedOutFiles; // Queues up when we have failed hot compiles
 		HashSet<int> mSlotDefineTypeIds;
 		HashSet<int> mNewlySlottedTypeIds;
@@ -284,7 +284,7 @@ public:
 
 	public:
 		HotState()
-		{			
+		{
 			mHotProject = NULL;
 			mLastStringId = -1;
 			mCommittedHotCompileIdx = 0;
@@ -298,28 +298,28 @@ public:
 		void RemovePendingChanges(BfTypeInstance* type);
 	};
 	HotData* mHotData;
-	HotState* mHotState;	
+	HotState* mHotState;
 	HotResolveData* mHotResolveData;
 
 	struct StringValueEntry
 	{
 		int mId;
 		BfIRValue mStringVal;
-	};		
+	};
 
 	struct TestMethod
 	{
 		String mName;
 		BfMethodInstance* mMethodInstance;
-	};	
+	};
 
-public:	
-	BfPassInstance* mPassInstance;	
+public:
+	BfPassInstance* mPassInstance;
 	FILE* mCompileLogFP;
 
 	CeMachine* mCeMachine;
 	int mCurCEExecuteId;
-	BfSystem* mSystem;	
+	BfSystem* mSystem;
 	bool mIsResolveOnly;
 	BfResolvePassData* mResolvePassData;
 	Dictionary<String, Array<int>> mAttributeTypeOptionMap;
@@ -343,13 +343,13 @@ public:
 	bool mDepsMayHaveDeletedTypes;
 	float mCompletionPct;
 	int mHSPreserveIdx;
-	BfModule* mLastAutocompleteModule;		
+	BfModule* mLastAutocompleteModule;
 	CompileState mCompileState;
 	HashSet<String> mRebuildFileSet;
 	HashSet<String> mRebuildChangedFileSet; // Files we had actual changes from
 
-	Array<BfVDataModule*> mVDataModules;	
-			
+	Array<BfVDataModule*> mVDataModules;
+
 	BfTypeDef* mBfObjectTypeDef;
 	BfTypeDef* mChar32TypeDef;
 	BfTypeDef* mFloatTypeDef;
@@ -360,16 +360,16 @@ public:
 	BfTypeDef* mArray2TypeDef;
 	BfTypeDef* mArray3TypeDef;
 	BfTypeDef* mArray4TypeDef;
-	BfTypeDef* mSpanTypeDef;	
+	BfTypeDef* mSpanTypeDef;
 	BfTypeDef* mRangeTypeDef;
 	BfTypeDef* mClosedRangeTypeDef;
 	BfTypeDef* mIndexTypeDef;
 	BfTypeDef* mIndexRangeTypeDef;
-		
-	BfTypeDef* mClassVDataTypeDef;	
-	
+
+	BfTypeDef* mClassVDataTypeDef;
+
 	BfTypeDef* mDbgRawAllocDataTypeDef;
-	BfTypeDef* mDeferredCallTypeDef;		
+	BfTypeDef* mDeferredCallTypeDef;
 	BfTypeDef* mDelegateTypeDef;
 	BfTypeDef* mFunctionTypeDef;
 	BfTypeDef* mActionTypeDef;
@@ -377,13 +377,13 @@ public:
 	BfTypeDef* mStringTypeDef;
 	BfTypeDef* mStringViewTypeDef;
 	BfTypeDef* mTypeTypeDef;
-	BfTypeDef* mValueTypeTypeDef;	
-	BfTypeDef* mResultTypeDef;	
-	BfTypeDef* mGCTypeDef;	
+	BfTypeDef* mValueTypeTypeDef;
+	BfTypeDef* mResultTypeDef;
+	BfTypeDef* mGCTypeDef;
 	BfTypeDef* mGenericIEnumerableTypeDef;
 	BfTypeDef* mGenericIEnumeratorTypeDef;
 	BfTypeDef* mGenericIRefEnumeratorTypeDef;
-	
+
 	BfTypeDef* mThreadTypeDef;
 	BfTypeDef* mInternalTypeDef;
 	BfTypeDef* mPlatformTypeDef;
@@ -395,15 +395,15 @@ public:
 	BfTypeDef* mIPrintableTypeDef;
 	BfTypeDef* mIHashableTypeDef;
 	BfTypeDef* mIComptimeTypeApply;
-	BfTypeDef* mIComptimeMethodApply;	
+	BfTypeDef* mIComptimeMethodApply;
 	BfTypeDef* mIOnTypeInitTypeDef;
 	BfTypeDef* mIOnTypeDoneTypeDef;
 	BfTypeDef* mIOnFieldInitTypeDef;
 	BfTypeDef* mIOnMethodInitTypeDef;
-	
+
 	BfTypeDef* mMethodRefTypeDef;
 	BfTypeDef* mNullableTypeDef;
-		
+
 	BfTypeDef* mPointerTTypeDef;
 	BfTypeDef* mPointerTypeDef;
 	BfTypeDef* mReflectTypeIdTypeDef;
@@ -420,17 +420,17 @@ public:
 	BfTypeDef* mReflectConstExprType;
 	BfTypeDef* mReflectSpecializedGenericType;
 	BfTypeDef* mReflectTypeInstanceTypeDef;
-	BfTypeDef* mReflectUnspecializedGenericType;		
+	BfTypeDef* mReflectUnspecializedGenericType;
 	BfTypeDef* mReflectFieldInfoTypeDef;
 	BfTypeDef* mReflectMethodInfoTypeDef;
-	
+
 	BfTypeDef* mSizedArrayTypeDef;
 	BfTypeDef* mAttributeTypeDef;
 	BfTypeDef* mAttributeUsageAttributeTypeDef;
 	BfTypeDef* mLinkNameAttributeTypeDef;
 	BfTypeDef* mCallingConventionAttributeTypeDef;
-	BfTypeDef* mOrderedAttributeTypeDef;	
-	BfTypeDef* mInlineAttributeTypeDef;	
+	BfTypeDef* mOrderedAttributeTypeDef;
+	BfTypeDef* mInlineAttributeTypeDef;
 	BfTypeDef* mCLinkAttributeTypeDef;
 	BfTypeDef* mImportAttributeTypeDef;
 	BfTypeDef* mExportAttributeTypeDef;
@@ -446,30 +446,30 @@ public:
 	BfTypeDef* mConstEvalAttributeTypeDef;
 	BfTypeDef* mNoExtensionAttributeTypeDef;
 	BfTypeDef* mCheckedAttributeTypeDef;
-	BfTypeDef* mUncheckedAttributeTypeDef;	
+	BfTypeDef* mUncheckedAttributeTypeDef;
 	BfTypeDef* mStaticInitAfterAttributeTypeDef;
-	BfTypeDef* mStaticInitPriorityAttributeTypeDef;	
+	BfTypeDef* mStaticInitPriorityAttributeTypeDef;
 	BfTypeDef* mTestAttributeTypeDef;
-	BfTypeDef* mThreadStaticAttributeTypeDef;	
+	BfTypeDef* mThreadStaticAttributeTypeDef;
 	BfTypeDef* mUnboundAttributeTypeDef;
 	BfTypeDef* mObsoleteAttributeTypeDef;
 	BfTypeDef* mErrorAttributeTypeDef;
 	BfTypeDef* mWarnAttributeTypeDef;
 	BfTypeDef* mConstSkipAttributeTypeDef;
 	BfTypeDef* mIgnoreErrorsAttributeTypeDef;
-	BfTypeDef* mReflectAttributeTypeDef;		
+	BfTypeDef* mReflectAttributeTypeDef;
 	BfTypeDef* mOnCompileAttributeTypeDef;
 
-	int mCurTypeId;	
+	int mCurTypeId;
 	int mTypeInitCount;
 	String mOutputPath;
-	Array<BfType*> mGenericInstancePurgatory;	
+	Array<BfType*> mGenericInstancePurgatory;
 	Array<int> mTypeIdFreeList;
 
 	int mMaxInterfaceSlots;
 	bool mInterfaceSlotCountChanged;
 
-public:		
+public:
 	bool IsTypeAccessible(BfType* checkType, BfProject* curProject);
 	bool IsTypeUsed(BfType* checkType, BfProject* curProject);
 	bool IsModuleAccessible(BfModule* module, BfProject* curProject);
@@ -479,22 +479,22 @@ public:
 	BfIRFunction CreateLoadSharedLibraries(BfVDataModule* bfModule, Array<BfMethodInstance*>& dllMethods);
 	void GetTestMethods(BfVDataModule* bfModule, Array<TestMethod>& testMethods, HashContext& vdataHashCtx);
 	void EmitTestMethod(BfVDataModule* bfModule, Array<TestMethod>& testMethods, BfIRValue& retValue);
-	void CreateVData(BfVDataModule* bfModule);	
+	void CreateVData(BfVDataModule* bfModule);
 	void UpdateDependencyMap(bool deleteUnusued, bool& didWork);
 	void SanitizeDependencyMap();
 	bool ProcessPurgatory(bool reifiedOnly);
 	bool VerifySlotNums();
 	bool QuickGenerateSlotNums();
 	bool SlowGenerateSlotNums();
-	void GenerateSlotNums();	
+	void GenerateSlotNums();
 	void GenerateDynCastData();
 	void UpdateRevisedTypes();
-	void VisitAutocompleteExteriorIdentifiers();		
+	void VisitAutocompleteExteriorIdentifiers();
 	void VisitSourceExteriorNodes();
 	void UpdateCompletion();
 	bool DoWorkLoop(bool onlyReifiedTypes = false, bool onlyReifiedMethods = false);
 	BfMangler::MangleKind GetMangleKind();
-	
+
 	BfTypeDef* GetArrayTypeDef(int dimensions);
 	void GenerateAutocompleteInfo();
 	void MarkStringPool(BfModule* module);
@@ -517,7 +517,7 @@ public:
 	bool IsCePaused();
 	bool EnsureCeUnpaused(BfType* refType);
 
-	void HotCommit();	
+	void HotCommit();
 	void HotResolve_Start(HotResolveFlags flags);
 	void HotResolve_PopulateMethodNameMap();
 	bool HotResolve_AddReachableMethod(BfHotMethod* hotMethod, HotTypeFlags flags, bool devirtualized, bool forceProcess = false);
@@ -532,24 +532,24 @@ public:
 
 public:
 	BfCompiler(BfSystem* bfSystem, bool isResolveOnly);
-	~BfCompiler();	
+	~BfCompiler();
 
-	bool Compile(const StringImpl& outputPath);	
+	bool Compile(const StringImpl& outputPath);
 	bool DoCompile(const StringImpl& outputPath);
 	void ClearResults();
-	void ProcessAutocompleteTempType();	
-	void GetSymbolReferences();	
+	void ProcessAutocompleteTempType();
+	void GetSymbolReferences();
 	void Cancel();
-	void RequestFastFinish();	
+	void RequestFastFinish();
 	String GetTypeDefList();
 	String GetGeneratorString(BfTypeDef* typeDef, BfTypeInstance* typeInst, const StringImpl& generatorMethodName, const StringImpl* args);
 	void HandleGeneratorErrors(StringImpl& result);
 	String GetGeneratorTypeDefList();
 	String GetGeneratorInitData(const StringImpl& typeName, const StringImpl& args);
 	String GetGeneratorGenData(const StringImpl& typeName, const StringImpl& args);
-	String GetTypeDefMatches(const StringImpl& searchSrc);	
+	String GetTypeDefMatches(const StringImpl& searchSrc);
 	void GetTypeDefs(const StringImpl& typeName, Array<BfTypeDef*>& typeDefs);
-	String GetTypeDefInfo(const StringImpl& typeName);	
+	String GetTypeDefInfo(const StringImpl& typeName);
 	int GetTypeId(const StringImpl& typeName);
 	BfType* GetType(const StringImpl& typeName);
 	int GetEmitSource(const StringImpl& fileName, StringImpl* outBuffer);
@@ -561,4 +561,3 @@ public:
 };
 
 NS_BF_END
-

+ 29 - 29
IDEHelper/Compiler/BfConstResolver.cpp

@@ -64,25 +64,25 @@ BfTypedValue BfConstResolver::Resolve(BfExpression* expr, BfType* wantType, BfCo
 						// Dot-initialized
 						if (memberRefExpr->mTarget == NULL)
 							arraySize = (int)invocationExpr->mArguments.size();
-					}					
+					}
 					else if (auto indexerExpr = BfNodeDynCast<BfIndexerExpression>(invocationExpr->mTarget))
 					{
 						if (indexerExpr->mArguments.size() == 0)
 						{
 							// Inferred-type sized array initializer
 							arraySize = (int)invocationExpr->mArguments.size();
-						}						
+						}
 					}
 				}
 			}
 
 			if (arraySize != -1)
-			{				
+			{
 				mResult = BfTypedValue(mModule->GetConstValue(arraySize), mModule->GetPrimitiveType(BfTypeCode_IntPtr));
 				return mResult;
 			}
 			else
-			{				
+			{
 				mResult = BfTypedValue(mModule->mBfIRBuilder->GetUndefConstValue(mModule->mBfIRBuilder->GetPrimitiveType(BfTypeCode_IntPtr)), mModule->GetPrimitiveType(BfTypeCode_IntPtr));
 				return mResult;
 			}
@@ -103,16 +103,16 @@ BfTypedValue BfConstResolver::Resolve(BfExpression* expr, BfType* wantType, BfCo
 	}
 
 	SetAndRestoreValue<bool> prevIgnoreWrites(mModule->mBfIRBuilder->mIgnoreWrites, wantIgnoreWrites);
-	
+
 	auto prevInsertBlock = mModule->mBfIRBuilder->GetInsertBlock();
 
 	mNoBind = true;
 	if (wantType != NULL)
 		mExpectingType = wantType;
 	VisitChildNoRef(expr);
-	
+
 	mResult = GetResult();
-	
+
 	auto compilerVal = mModule->GetCompilerFieldValue(mResult);
 	if (compilerVal)
 		mResult = compilerVal;
@@ -131,14 +131,14 @@ BfTypedValue BfConstResolver::Resolve(BfExpression* expr, BfType* wantType, BfCo
 					(toType == mResult.mType)))
 			{
 				auto constant = mModule->mBfIRBuilder->GetConstant(mResult.mValue);
-				
+
 				if (constant->mTypeCode == BfTypeCode_NullPtr)
 				{
 					return mModule->GetDefaultTypedValue(toType);
 				}
 				else
 				{
-					int stringId = mModule->GetStringPoolIdx(mResult.mValue);					
+					int stringId = mModule->GetStringPoolIdx(mResult.mValue);
 					if (stringId != -1)
 					{
 						if ((flags & BfConstResolveFlag_ActualizeValues) != 0)
@@ -166,9 +166,9 @@ BfTypedValue BfConstResolver::Resolve(BfExpression* expr, BfType* wantType, BfCo
 				mResult = convValue;
 		}
 		else
-		{			
+		{
 			mResult = mModule->Cast(expr, mResult, wantType, (BfCastFlags)(BfCastFlags_NoConversionOperator | (explicitCast ? BfCastFlags_Explicit : BfCastFlags_None)));
-		}				
+		}
 	}
 
 	if (mResult.mKind == BfTypedValueKind_GenericConstValue)
@@ -195,9 +195,9 @@ BfTypedValue BfConstResolver::Resolve(BfExpression* expr, BfType* wantType, BfCo
 					isConst = false;
 			}
 		}
-		
+
 		if ((!isConst) && ((mBfEvalExprFlags & BfEvalExprFlags_AllowNonConst) == 0))
-		{			
+		{
 			mModule->Fail("Expression does not evaluate to a constant value", expr);
 
 			if (wantType != NULL)
@@ -210,7 +210,7 @@ BfTypedValue BfConstResolver::Resolve(BfExpression* expr, BfType* wantType, BfCo
 	{
 		if (wantType != NULL)
 			mResult = mModule->GetDefaultTypedValue(wantType);
-	}	
+	}
 
 	if (prevInsertBlock)
 		mModule->mBfIRBuilder->SetInsertPoint(prevInsertBlock);
@@ -221,7 +221,7 @@ BfTypedValue BfConstResolver::Resolve(BfExpression* expr, BfType* wantType, BfCo
 		mModule->mBfIRBuilder->SetInsertPoint(prevInsertBlock);
 	}*/
 
-	mModule->FixIntUnknown(mResult);	
+	mModule->FixIntUnknown(mResult);
 
 	if ((flags & BfConstResolveFlag_NoActualizeValues) == 0)
 	{
@@ -240,10 +240,10 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
 	int extendedParamIdx = 0;
 
 	SetAndRestoreValue<bool> ignoreWrites(mModule->mBfIRBuilder->mIgnoreWrites, true);
-	
+
 	llvm::SmallVector<BfIRValue, 4> expandedParamsConstValues;
 	BfType* expandedParamsElementType = NULL;
-	
+
 	// We don't do GetMethodInstance in mModule, because our module may not have init finished yet
 	//auto targetModule = methodMatcher->mBestMethodTypeInstance->mModule;
 	auto targetModule = mModule->mContext->mUnreifiedModule;
@@ -260,7 +260,7 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
 	auto& arguments = methodMatcher->mArguments;
 
 	mModule->AddDependency(methodInstance->mReturnType, mModule->mCurTypeInstance, BfDependencyMap::DependencyFlag_LocalUsage);
-	for (int paramIdx = 0; paramIdx < methodInstance->GetParamCount(); paramIdx++)	
+	for (int paramIdx = 0; paramIdx < methodInstance->GetParamCount(); paramIdx++)
 	{
 		auto paramType = methodInstance->GetParamType(paramIdx);
 		mModule->AddDependency(paramType, mModule->mCurTypeInstance, BfDependencyMap::DependencyFlag_LocalUsage);
@@ -271,7 +271,7 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
 		if (paramIdx >= (int)methodInstance->GetParamCount())
 		{
 			if (argIdx < (int)arguments.size())
-			{				
+			{
 				BfAstNode* errorRef = arguments[methodInstance->GetParamCount()].mExpression;
 				if (errorRef->GetSourceData() == NULL)
 					errorRef = targetSrc;
@@ -281,7 +281,7 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
 				return false;
 			}
 			break;
-		}				
+		}
 
 		BfType* wantType = NULL;
 		if (expandedParamsElementType != NULL)
@@ -351,7 +351,7 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
 						if (attributeDirective->mCtorCloseParen != NULL)
 							refNode = attributeDirective->mCtorCloseParen;
 					}
-				}				
+				}
 
 				auto autoComplete = GetAutoComplete();
 				if (autoComplete != NULL)
@@ -361,14 +361,14 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
 						autoComplete->CheckEmptyStart(prevNode, wantType);
 					}
 				}
-				
+
 				if (mModule->PreFail())
 					mModule->Fail(StrFormat("Not enough parameters specified. Expected %d more.", methodInstance->GetParamCount() - (int)arguments.size()), refNode);
 				return false;
 			}
 
 			auto foreignDefaultVal = methodInstance->mDefaultValues[argIdx];
-			auto foreignConst = methodInstance->GetOwner()->mConstHolder->GetConstant(foreignDefaultVal.mValue);			
+			auto foreignConst = methodInstance->GetOwner()->mConstHolder->GetConstant(foreignDefaultVal.mValue);
 			argValue = mModule->GetTypedValueFromConstant(foreignConst, methodInstance->GetOwner()->mConstHolder, foreignDefaultVal.mType);
 		}
 
@@ -387,7 +387,7 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
 				arg.mArgFlags = BfArgFlag_None;
 			}
 		}
-		
+
 		if (!argValue)
 			return BfTypedValue();
 
@@ -410,14 +410,14 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
 			extendedParamIdx++;
 		}
 		else
-		{	
+		{
 			bool requiresConst = false;
 			if ((mModule->mCurMethodInstance == NULL) || (mModule->mCurMethodInstance->mMethodDef->mMethodType != BfMethodType_Mixin))
 				requiresConst = true;
 
 			if ((requiresConst) && (argValue.mValue.IsFake()) && (!argValue.mType->IsValuelessType()))
-			{				
-				mModule->Fail("Expression does not evaluate to a constant value", argExpr);				
+			{
+				mModule->Fail("Expression does not evaluate to a constant value", argExpr);
 			}
 
 			if (!argValue.mType->IsVar())
@@ -433,11 +433,11 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
 	}
 
 	if (expandedParamsElementType != NULL)
-	{				
+	{
 		auto arrayType = mModule->mBfIRBuilder->GetSizedArrayType(mModule->mBfIRBuilder->MapType(expandedParamsElementType), (int)expandedParamsConstValues.size());
 		auto constArray = mModule->mBfIRBuilder->CreateConstAgg(arrayType, expandedParamsConstValues);
 		llvmArgs.push_back(constArray);
-	}	
+	}
 
 	return true;
 }

+ 2 - 2
IDEHelper/Compiler/BfConstResolver.h

@@ -24,13 +24,13 @@ enum BfConstResolveFlags
 class BfConstResolver : public BfExprEvaluator
 {
 public:
-	bool mIsInvalidConstExpr;	
+	bool mIsInvalidConstExpr;
 
 public:
 	virtual bool CheckAllowValue(const BfTypedValue& typedValue, BfAstNode* refNode) override;
 
 public:
-	BfConstResolver(BfModule* bfModule);		
+	BfConstResolver(BfModule* bfModule);
 
 	BfTypedValue Resolve(BfExpression* expr, BfType* wantType = NULL, BfConstResolveFlags flags = BfConstResolveFlag_None);
 	bool PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatcher* methodMatcher, Array<BfIRValue>& llvmArgs);

File diff ditekan karena terlalu besar
+ 163 - 164
IDEHelper/Compiler/BfContext.cpp


+ 48 - 48
IDEHelper/Compiler/BfContext.h

@@ -12,22 +12,22 @@ public:
 	BfModule* mFromModule;
 	int mRevision;
 	int mSignatureRevision;
-	int mFromModuleRevision;	
+	int mFromModuleRevision;
 	int mFromModuleRebuildIdx;
-	int mReqId;	
-	static int sCurReqId;		
+	int mReqId;
+	static int sCurReqId;
 
 public:
 	BfWorkListEntry()
 	{
 		mType = NULL;
 		mFromModule = NULL;
-		mRevision = -1;		
+		mRevision = -1;
 		mSignatureRevision = -1;
 		mFromModuleRevision = -1;
 		mFromModuleRebuildIdx = -1;
-		mReqId = ++sCurReqId;		
-	}	
+		mReqId = ++sCurReqId;
+	}
 };
 
 class BfTypeProcessRequest : public BfWorkListEntry
@@ -43,7 +43,7 @@ public:
 
 class BfMethodSpecializationRequest : public BfWorkListEntry
 {
-public:	
+public:
 	int32 mMethodIdx;
 	BfTypeVector mMethodGenericArguments;
 	BfGetMethodInstanceFlags mFlags;
@@ -51,7 +51,7 @@ public:
 
 public:
 	BfMethodSpecializationRequest()
-	{		
+	{
 		mMethodIdx = -1;
 		mFlags = BfGetMethodInstanceFlag_None;
 		mForeignType = NULL;
@@ -97,9 +97,9 @@ public:
 
 class BfInlineMethodRequest : public BfMethodProcessRequest
 {
-public:	
+public:
 	BfIRFunction mFunc;
-	
+
 	~BfInlineMethodRequest()
 	{
 		mMethodInstance = NULL;
@@ -110,12 +110,12 @@ class BfTypeRefVerifyRequest : public BfWorkListEntry
 {
 public:
 	BfTypeInstance* mCurTypeInstance;
-	BfAstNode* mRefNode;	
+	BfAstNode* mRefNode;
 };
 
 class BfMidCompileRequest : public BfWorkListEntry
 {
-public:	
+public:
 	String mReason;
 };
 
@@ -153,15 +153,15 @@ public:
 
 	BfType* mType;
 	BfTypeDef* mGlobalContainerCurUserTypeDef;
-	Array<BfGlobalContainerEntry> mGlobalContainers; // All global containers that are visible	
+	Array<BfGlobalContainerEntry> mGlobalContainers; // All global containers that are visible
 
 	BfPopulateType mPopulateType;
 	BfTypeReference* mCurBaseTypeRef;
 	BfTypeInstance* mCurBaseType;
 	BfTypeReference* mCurAttributeTypeRef;
-	BfFieldDef* mCurFieldDef;	
+	BfFieldDef* mCurFieldDef;
 	BfTypeDef* mCurTypeDef;
-	BfTypeDef* mForceActiveTypeDef;	
+	BfTypeDef* mForceActiveTypeDef;
 	BfProject* mActiveProject;
 	ResolveKind mResolveKind;
 	BfAstNode* mCurVarInitializer;
@@ -209,7 +209,7 @@ public:
 class BfSavedTypeData
 {
 public:
-	BfHotTypeData* mHotTypeData;	
+	BfHotTypeData* mHotTypeData;
 	int mTypeId;
 
 public:
@@ -221,7 +221,7 @@ public:
 
 struct SpecializedErrorData
 {
-	// We need to store errors during type specialization and method specialization, 
+	// We need to store errors during type specialization and method specialization,
 	//  because if the type is deleted we need to clear the errors
 	BfTypeInstance* mRefType;
 	BfModule* mModule;
@@ -241,8 +241,8 @@ struct BfCaseInsensitiveStringHash
 {
 	size_t operator()(const StringImpl& str) const
 	{
-		int curHash = 0;		
-		for (int i = 0; i < (int)str.length(); i++)		
+		int curHash = 0;
+		for (int i = 0; i < (int)str.length(); i++)
 			curHash = ((curHash ^ (int)(intptr)toupper(str[i])) << 5) - curHash;
 		return curHash;
 	}
@@ -251,7 +251,7 @@ struct BfCaseInsensitiveStringHash
 struct BfCaseInsensitiveStringEquals
 {
 	bool operator()(const StringImpl& lhs, const StringImpl& rhs) const
-	{		
+	{
 		if (lhs.length() != rhs.length())
 			return false;
 		return _stricmp(lhs.c_str(), rhs.c_str()) == 0;
@@ -270,7 +270,7 @@ public:
 		{
 			T*& ref = (*this)[idx];
 			if (ref != NULL)
-				(*ref).~T();			
+				(*ref).~T();
 			Deque<T*>::RemoveAt(0);
 			if (this->mSize == 0)
 			{
@@ -303,7 +303,7 @@ public:
 		T* item = mWorkAlloc.Alloc<T>();
 		this->Add(item);
 		return item;
-	}	
+	}
 };
 
 template <typename T>
@@ -348,7 +348,7 @@ public:
 
 	bool operator==(const BfConstraintState& other) const
 	{
-		return 
+		return
 			(mGenericParamInstance == other.mGenericParamInstance) &&
 			(mLeftType == other.mLeftType) &&
 			(mRightType == other.mRightType);
@@ -358,9 +358,9 @@ public:
 class BfContext
 {
 public:
-	CritSect mCritSect;	
-	bool mDeleting;	
-	
+	CritSect mCritSect;
+	bool mDeleting;
+
 	BfTypeState* mCurTypeState;
 	BfSizedArray<BfNamespaceDeclaration*>* mCurNamespaceNodes;
 	BfConstraintState* mCurConstraintState;
@@ -369,25 +369,25 @@ public:
 	bool mAssertOnPopulateType;
 
 	BfSystem* mSystem;
-	BfCompiler* mCompiler;		
-	
+	BfCompiler* mCompiler;
+
 	bool mAllowLockYield;
 	bool mLockModules;
 	BfModule* mScratchModule;
-	BfModule* mUnreifiedModule;	
+	BfModule* mUnreifiedModule;
 	HashSet<String> mUsedModuleNames;
 	Dictionary<BfProject*, BfModule*> mProjectModule;
 	Array<BfModule*> mModules;
-	Array<BfModule*> mDeletingModules;	
-	HashSet<BfTypeInstance*> mFailTypes; // All types handled after a failure need to be rebuild on subsequent compile		
+	Array<BfModule*> mDeletingModules;
+	HashSet<BfTypeInstance*> mFailTypes; // All types handled after a failure need to be rebuild on subsequent compile
 	HashSet<BfTypeInstance*> mReferencedIFaceSlots;
 
 	BfMethodInstance* mValueTypeDeinitSentinel;
 
 	Array<BfAstNode*> mTempNodes;
-	BfResolvedTypeSet mResolvedTypes;	
+	BfResolvedTypeSet mResolvedTypes;
 	Array<BfType*> mTypes; // Can contain NULLs for deleted types
-	Array<BfFieldInstance*> mFieldResolveReentrys; // For detecting 'var' field circular refs	
+	Array<BfFieldInstance*> mFieldResolveReentrys; // For detecting 'var' field circular refs
 	Dictionary<String, BfSavedTypeData*> mSavedTypeDataMap;
 	Array<BfSavedTypeData*> mSavedTypeData;
 
@@ -399,7 +399,7 @@ public:
 
 	PtrWorkQueue<BfModule*> mReifyModuleWorkList;
 	WorkQueue<BfMethodProcessRequest> mMethodWorkList;
-	WorkQueue<BfInlineMethodRequest> mInlineMethodWorkList;	
+	WorkQueue<BfInlineMethodRequest> mInlineMethodWorkList;
 	WorkQueue<BfTypeProcessRequest> mPopulateTypeWorkList;
 	WorkQueue<BfMethodSpecializationRequest> mMethodSpecializationWorkList;
 	WorkQueue<BfTypeRefVerifyRequest> mTypeRefVerifyWorkList;
@@ -409,7 +409,7 @@ public:
 	bool mHasReifiedQueuedRebuildTypes;
 
 	Array<BfGenericParamType*> mGenericParamTypes[3];
-	
+
 	Array<BfType*> mTypeGraveyard;
 	Array<BfTypeDef*> mTypeDefGraveyard;
 	Array<BfLocalMethod*> mLocalMethodGraveyard;
@@ -418,9 +418,9 @@ public:
 	Dictionary<int, BfStringPoolEntry> mStringObjectIdMap;
 	int mCurStringObjectPoolId;
 
-	HashSet<BfTypeInstance*> mQueuedSpecializedMethodRebuildTypes;	
+	HashSet<BfTypeInstance*> mQueuedSpecializedMethodRebuildTypes;
 
-	BfAllocPool<BfPointerType> mPointerTypePool;	
+	BfAllocPool<BfPointerType> mPointerTypePool;
 	BfAllocPool<BfArrayType> mArrayTypePool;
 	BfAllocPool<BfSizedArrayType> mSizedArrayTypePool;
 	BfAllocPool<BfUnknownSizedArrayType> mUnknownSizedArrayTypePool;
@@ -429,13 +429,13 @@ public:
 	BfAllocPool<BfTypeAliasType> mAliasTypePool;
 	BfAllocPool<BfRefType> mRefTypePool;
 	BfAllocPool<BfModifiedTypeType> mModifiedTypeTypePool;
-	BfAllocPool<BfTypeInstance> mGenericTypeInstancePool;	
+	BfAllocPool<BfTypeInstance> mGenericTypeInstancePool;
 	BfAllocPool<BfArrayType> mArrayTypeInstancePool;
 	BfAllocPool<BfGenericParamType> mGenericParamTypePool;
 	BfAllocPool<BfDirectTypeDefReference> mTypeDefTypeRefPool;
 	BfAllocPool<BfConcreteInterfaceType> mConcreteInterfaceTypePool;
 	BfAllocPool<BfConstExprValueType> mConstExprValueTypePool;
-	BfAllocPool<BfDelegateType> mDelegateTypePool;	
+	BfAllocPool<BfDelegateType> mDelegateTypePool;
 	BfPrimitiveType* mPrimitiveTypes[BfTypeCode_Length];
 	BfPrimitiveType* mPrimitiveStructTypes[BfTypeCode_Length];
 
@@ -447,15 +447,15 @@ public:
 	void PopulateHotTypeDataVTable(BfTypeInstance* typeInstance);
 	void DeleteType(BfType* type, bool deferDepRebuilds = false);
 	void UpdateAfterDeletingTypes();
-	void VerifyTypeLookups(BfTypeInstance* typeInst);		
+	void VerifyTypeLookups(BfTypeInstance* typeInst);
 	void GenerateModuleName_TypeInst(BfTypeInstance* typeInst, StringImpl& name);
 	void GenerateModuleName_Type(BfType* type, StringImpl& name);
 	void GenerateModuleName(BfTypeInstance* typeInst, StringImpl& name);
 	bool IsSentinelMethod(BfMethodInstance* methodInstance);
-	void SaveDeletingType(BfType* type);		
+	void SaveDeletingType(BfType* type);
 	BfType* FindType(const StringImpl& typeName);
 	String TypeIdToString(int typeId);
-	BfHotTypeData* GetHotTypeData(int typeId);	
+	BfHotTypeData* GetHotTypeData(int typeId);
 	void ReflectInit();
 
 public:
@@ -464,28 +464,28 @@ public:
 
 	void ReportMemory(MemReporter* memReporter);
 	void ProcessMethod(BfMethodInstance* methodInstance);
-	int GetStringLiteralId(const StringImpl& str);		
+	int GetStringLiteralId(const StringImpl& str);
 	void CheckLockYield();
 	bool IsCancellingAndYield();
 	void QueueFinishModule(BfModule * module);
 	void CancelWorkItems();
 	bool ProcessWorkList(bool onlyReifiedTypes, bool onlyReifiedMethods);
 	void HandleChangedTypeDef(BfTypeDef* typeDef, bool isAutoCompleteTempType = false);
-	void PreUpdateRevisedTypes();	
-	void UpdateRevisedTypes();	
-	void VerifyTypeLookups();	
+	void PreUpdateRevisedTypes();
+	void UpdateRevisedTypes();
+	void VerifyTypeLookups();
 	void QueueMethodSpecializations(BfTypeInstance* typeInst, bool checkSpecializedMethodRebuildFlag);
 	void MarkAsReferenced(BfDependedType* depType);
 	void RemoveInvalidFailTypes();
 	bool IsWorkItemValid(BfWorkListEntry* item);
 	bool IsWorkItemValid(BfMethodProcessRequest* item);
 	bool IsWorkItemValid(BfMethodSpecializationRequest* item);
-	void RemoveInvalidWorkItems();	
+	void RemoveInvalidWorkItems();
 	BfType* FindTypeById(int typeId);
 	void AddTypeToWorkList(BfType* type);
 	void ValidateDependencies();
 	void RebuildType(BfType* type, bool deleteOnDemandTypes = true, bool rebuildModule = true, bool placeSpecializiedInPurgatory = true);
-	void RebuildDependentTypes(BfDependedType* dType);	
+	void RebuildDependentTypes(BfDependedType* dType);
 	void QueueMidCompileRebuildDependentTypes(BfDependedType* dType, const String& reason);
 	void RebuildDependentTypes_MidCompile(BfDependedType* dType, const String& reason);
 	bool CanRebuild(BfType* type);

File diff ditekan karena terlalu besar
+ 155 - 155
IDEHelper/Compiler/BfDefBuilder.cpp


+ 7 - 7
IDEHelper/Compiler/BfDefBuilder.h

@@ -39,14 +39,14 @@ public:
 	Array<BfTypeReference*> mInternalAccessSet;
 	HashContext* mFullHashCtx;
 	HashContext* mSignatureHashCtx;
-	
+
 	Array<NamespaceState> mFileLevelNamespaceState;
-	int mNamespaceBlockDepth;	
+	int mNamespaceBlockDepth;
 
 public:
 	void ParseGenericParams(BfGenericParamsDeclaration* genericParamsDecl, BfGenericConstraintsDeclaration* genericConstraints, Array<BfGenericParamDef*>& genericParams, Array<BfExternalConstraintDef>* externConstraintDefs, int outerGenericSize, bool isInGeneric);
 	BfProtection GetProtection(BfAstNode* protectionNode);
-	bool WantsNode(BfAstNode* wholeNode, BfAstNode* startNode = NULL, int addLen = 0);		
+	bool WantsNode(BfAstNode* wholeNode, BfAstNode* startNode = NULL, int addLen = 0);
 	//static BfNamedTypeReference* AllocTypeReference(BfSource* bfSource, const StringImpl& typeName);
 	//static BfResolvedTypeReference* AllocTypeReference(BfSource* bfSource, BfType* type);
 	static BfFieldDef* AddField(BfTypeDef* typeDef, BfTypeReference* typeRef, const StringImpl& name);
@@ -67,18 +67,18 @@ public:
 	~BfDefBuilder();
 
 	void Process(BfPassInstance* passInstance, BfSource* bfSource, bool fullRefresh);
-	void RemoveDefsFrom(BfSource* bfSource);	
-	
+	void RemoveDefsFrom(BfSource* bfSource);
+
 	virtual void Visit(BfIdentifierNode* identifier) override;
 	virtual void Visit(BfMethodDeclaration* methodDeclaration) override;
 	virtual void Visit(BfConstructorDeclaration* ctorDeclaration) override;
 	virtual void Visit(BfPropertyDeclaration* propertyDeclaration) override;
-	virtual void Visit(BfFieldDeclaration* fieldDeclaration) override;	
+	virtual void Visit(BfFieldDeclaration* fieldDeclaration) override;
 	virtual void Visit(BfEnumCaseDeclaration* enumCaseDeclaration) override;
 	virtual void Visit(BfTypeDeclaration* typeDeclaration) override;
 	virtual void Visit(BfUsingDirective* usingDirective) override;
 	virtual void Visit(BfUsingModDirective* usingDirective) override;
-	virtual void Visit(BfNamespaceDeclaration* namespaceDeclaration) override;	
+	virtual void Visit(BfNamespaceDeclaration* namespaceDeclaration) override;
 	virtual void Visit(BfBlock* block) override;
 	virtual void Visit(BfRootNode* rootNode) override;
 };

+ 16 - 18
IDEHelper/Compiler/BfDeferEvalChecker.cpp

@@ -8,14 +8,14 @@ BfDeferEvalChecker::BfDeferEvalChecker()
 	mRootNode = NULL;
 	mNeedsDeferEval = false;
 	mDeferLiterals = true;
-	mDeferDelegateBind = true;	
+	mDeferDelegateBind = true;
 }
 
 void BfDeferEvalChecker::Check(BfAstNode* node)
 {
 	if (auto namedNode = BfNodeDynCastExact<BfNamedExpression>(node))
 		node = namedNode->mExpression;
-	
+
 	if (node == NULL)
 		return;
 
@@ -46,16 +46,16 @@ void BfDeferEvalChecker::Visit(BfLiteralExpression* literalExpr)
 	case BfTypeCode_Boolean:
 	case BfTypeCode_Char8:
 	case BfTypeCode_Int8:
-	case BfTypeCode_UInt8:		
-	case BfTypeCode_Int16:		
+	case BfTypeCode_UInt8:
+	case BfTypeCode_Int16:
 	case BfTypeCode_UInt16:
 	case BfTypeCode_Int32:
-	case BfTypeCode_UInt32:		
-	case BfTypeCode_Int64:		
+	case BfTypeCode_UInt32:
+	case BfTypeCode_Int64:
 	case BfTypeCode_UInt64:
-	case BfTypeCode_IntPtr:		
+	case BfTypeCode_IntPtr:
 	case BfTypeCode_UIntPtr:
-	case BfTypeCode_IntUnknown:		
+	case BfTypeCode_IntUnknown:
 	case BfTypeCode_UIntUnknown:
 		if (mDeferLiterals)
 			mNeedsDeferEval = true;
@@ -63,11 +63,10 @@ void BfDeferEvalChecker::Visit(BfLiteralExpression* literalExpr)
 	default:
 		mNeedsDeferEval = false;
 	}
-	
 }
 
 void BfDeferEvalChecker::Visit(BfCastExpression* castExpr)
-{	
+{
 	if (auto namedTypeRef = BfNodeDynCastExact<BfNamedTypeReference>(castExpr->mTypeRef))
 	{
 		if (namedTypeRef->ToString() == "ExpectedType")
@@ -122,11 +121,11 @@ void BfDeferEvalChecker::Visit(BfDelegateBindExpression* delegateBindExpr)
 }
 
 void BfDeferEvalChecker::Visit(BfConditionalExpression* condExpr)
-{	
+{
 	VisitChild(condExpr->mConditionExpression);
 	bool prev = mNeedsDeferEval;
 	VisitChild(condExpr->mTrueExpression);
-	prev |= mNeedsDeferEval;	
+	prev |= mNeedsDeferEval;
 	VisitChild(condExpr->mFalseExpression);
 	mNeedsDeferEval |= prev;
 }
@@ -154,7 +153,7 @@ void BfDeferEvalChecker::Visit(BfObjectCreateExpression * objCreateExpr)
 	{
 		if (objCreateExpr->mTypeRef->IsExact<BfDotTypeReference>())
 			mNeedsDeferEval = true;
-	}	
+	}
 }
 
 void BfDeferEvalChecker::Visit(BfBinaryOperatorExpression* binOpExpr)
@@ -170,14 +169,14 @@ void BfDeferEvalChecker::Visit(BfBinaryOperatorExpression* binOpExpr)
 	case BfBinaryOp_BitwiseOr:
 	case BfBinaryOp_ExclusiveOr:
 	case BfBinaryOp_LeftShift:
-	case BfBinaryOp_RightShift:	
+	case BfBinaryOp_RightShift:
 	case BfBinaryOp_GreaterThan:
 	case BfBinaryOp_LessThan:
 	case BfBinaryOp_GreaterThanOrEqual:
 	case BfBinaryOp_LessThanOrEqual:
 		{
 			VisitChild(binOpExpr->mLeft);
-			bool prev = mNeedsDeferEval;			
+			bool prev = mNeedsDeferEval;
 			VisitChild(binOpExpr->mRight);
 			mNeedsDeferEval |= prev;
 		}
@@ -188,7 +187,7 @@ void BfDeferEvalChecker::Visit(BfBinaryOperatorExpression* binOpExpr)
 }
 
 void BfDeferEvalChecker::Visit(BfDefaultExpression* defaultExpr)
-{	
+{
 	if (defaultExpr->mTypeRef == NULL)
 		mNeedsDeferEval = true;
 }
@@ -197,5 +196,4 @@ void BfDeferEvalChecker::Visit(BfVariableDeclaration* varDecl)
 {
 	if (varDecl != mRootNode)
 		mNeedsDeferEval = true;
-}
-
+}

+ 2 - 3
IDEHelper/Compiler/BfDeferEvalChecker.h

@@ -11,7 +11,7 @@ public:
 	BfAstNode* mRootNode;
 	bool mNeedsDeferEval;
 	bool mDeferDelegateBind;
-	bool mDeferLiterals;	
+	bool mDeferLiterals;
 
 public:
 	BfDeferEvalChecker();
@@ -19,7 +19,7 @@ public:
 	void Check(BfAstNode* node);
 
 	virtual void Visit(BfAstNode* node) override;
-	
+
 	virtual void Visit(BfAttributedExpression* attributedExpr) override;
 	virtual void Visit(BfInitializerExpression* collectionInitExpr) override;
 	virtual void Visit(BfLiteralExpression* literalExpr) override;
@@ -38,5 +38,4 @@ public:
 	virtual void Visit(BfVariableDeclaration* varDecl) override;
 };
 
-
 NS_BF_END

File diff ditekan karena terlalu besar
+ 162 - 173
IDEHelper/Compiler/BfDemangler.cpp


+ 10 - 10
IDEHelper/Compiler/BfDemangler.h

@@ -14,7 +14,7 @@ public:
 	int mCurIdx;
 	String mResult;
 	bool mFailed;
-	String mMangledName;		
+	String mMangledName;
 	SubstituteList mSubstituteList;
 	bool mInArgs;
 	bool mBeefFixed;
@@ -28,25 +28,25 @@ public:
 
 class DwDemangler : public DemangleBase
 {
-public:	
+public:
 	SubstituteList mTemplateList;
 	bool mIsFirstName;
-	int mTemplateDepth;	
-	bool mOmitSubstituteAdd;	
+	int mTemplateDepth;
+	bool mOmitSubstituteAdd;
 	bool mCaptureTargetType;
 	bool mFunctionPopSubstitute;
-	bool mRawDemangle;	
+	bool mRawDemangle;
 
-public:	
+public:
 	bool DemangleEnd();
 	bool DemangleArrayType(StringImpl& outName);
 	bool DemangleBuiltinType(StringImpl& outName);
 	bool DemangleFunctionType(StringImpl& outName);
 	bool DemangleSourceName(StringImpl& outName);
-	bool DemangleRefQualifier(StringImpl& outName);	
+	bool DemangleRefQualifier(StringImpl& outName);
 	bool DemangleType(StringImpl& outName);
 	bool DemangleNestedName(StringImpl& outName);
-	bool DemangleCVQualifiers(StringImpl& outName);		
+	bool DemangleCVQualifiers(StringImpl& outName);
 	bool DemangleOperatorName(StringImpl& outName);
 	bool DemangleExprPriamry(StringImpl& outName);
 	bool DemangleTemplateArgPack(StringImpl& outName);
@@ -62,7 +62,7 @@ public:
 	bool DemangleName(StringImpl& outName, bool* outHasTemplateArgs = NULL);
 	bool DemangleFunction(StringImpl& outName);
 
-public:	
+public:
 	DwDemangler();
 
 	String Demangle(const StringImpl& mangledName);
@@ -104,7 +104,7 @@ public:
 	bool DemangleType();
 	bool DemangleScopedName();
 	bool DemangleName();
-	
+
 public:
 	MsDemangleScanner();
 

+ 49 - 52
IDEHelper/Compiler/BfElementVisitor.cpp

@@ -6,7 +6,6 @@ USING_NS_BF;
 
 BfElementVisitor::BfElementVisitor()
 {
-	
 }
 
 void BfElementVisitor::Visit(BfTypedValueExpression* typedValueExpr)
@@ -36,7 +35,7 @@ void BfElementVisitor::Visit(BfPreprocessorDefinedExpression* definedExpr)
 {
 	Visit(definedExpr->ToBase());
 
-	VisitChild(definedExpr->mIdentifier);	
+	VisitChild(definedExpr->mIdentifier);
 }
 
 void BfElementVisitor::Visit(BfAttributeDirective* attributeDirective)
@@ -65,7 +64,7 @@ void BfElementVisitor::Visit(BfGenericParamsDeclaration* genericParams)
 	for (auto& val : genericParams->mGenericParams)
 		VisitChild(val);
 	for (auto& val : genericParams->mCommas)
-		VisitChild(val);	
+		VisitChild(val);
 	VisitChild(genericParams->mCloseChevron);
 }
 
@@ -84,7 +83,7 @@ void BfElementVisitor::Visit(BfGenericConstraintsDeclaration* genericConstraints
 	Visit(genericConstraints->ToBase());
 
 	for (auto genericConstraintNode : genericConstraints->mGenericConstraints)
-	{		
+	{
 		if (auto genericConstraint = BfNodeDynCast<BfGenericConstraint>(genericConstraintNode))
 		{
 			VisitChild(genericConstraint->mWhereToken);
@@ -100,7 +99,7 @@ void BfElementVisitor::Visit(BfGenericConstraintsDeclaration* genericConstraints
 			VisitChild(genericConstraintExpr->mWhereToken);
 			VisitChild(genericConstraintExpr->mExpression);
 		}
-	}		
+	}
 }
 
 void BfElementVisitor::Visit(BfGenericArgumentsNode* genericArgumentsNode)
@@ -111,7 +110,7 @@ void BfElementVisitor::Visit(BfGenericArgumentsNode* genericArgumentsNode)
 	for (auto& val : genericArgumentsNode->mGenericArgs)
 		VisitChild(val);
 	for (auto& val : genericArgumentsNode->mCommas)
-		VisitChild(val);	
+		VisitChild(val);
 	VisitChild(genericArgumentsNode->mCloseChevron);
 }
 
@@ -169,7 +168,7 @@ void BfElementVisitor::Visit(BfNewNode* newNode)
 void BfElementVisitor::Visit(BfLabeledBlock* labeledBlock)
 {
 	Visit(labeledBlock->ToBase());
-	
+
 	VisitChild(labeledBlock->mBlock);
 }
 
@@ -266,7 +265,7 @@ void BfElementVisitor::Visit(BfQualifiedNameNode* nameNode)
 
 void BfElementVisitor::Visit(BfThisExpression* thisExpr)
 {
-	Visit(thisExpr->ToBase());	
+	Visit(thisExpr->ToBase());
 }
 
 void BfElementVisitor::Visit(BfBaseExpression* baseExpr)
@@ -306,9 +305,9 @@ void BfElementVisitor::Visit(BfCollectionInitializerExpression* collectionInitEx
 
  	VisitChild(collectionInitExpr->mOpenBrace);
 	for (auto& val : collectionInitExpr->mValues)
-		VisitChild(val);	
+		VisitChild(val);
 	for (auto& val : collectionInitExpr->mCommas)
-		VisitChild(val);	
+		VisitChild(val);
 	VisitChild(collectionInitExpr->mCloseBrace);
 }
 
@@ -327,7 +326,7 @@ void BfElementVisitor::Visit(BfNamedTypeReference* typeRef)
 void BfElementVisitor::Visit(BfQualifiedTypeReference* qualifiedTypeRef)
 {
 	Visit(qualifiedTypeRef->ToBase());
-	
+
 	VisitChild(qualifiedTypeRef->mLeft);
 	VisitChild(qualifiedTypeRef->mDot);
 	VisitChild(qualifiedTypeRef->mRight);
@@ -381,17 +380,17 @@ void BfElementVisitor::Visit(BfConstExprTypeRef* typeRef)
 void BfElementVisitor::Visit(BfRefTypeRef* typeRef)
 {
 	Visit((BfTypeReference*)typeRef); // Skip the Elemented part so we can put the element in the right spot
-	
+
 	VisitChild(typeRef->mRefToken);
 	VisitChild(typeRef->mElementType);
 }
 
 void BfElementVisitor::Visit(BfModifiedTypeRef * typeRef)
-{	
+{
 	Visit((BfTypeReference*)typeRef); // Skip the Elemented part so we can put the element in the right spot
 
 	VisitChild(typeRef->mRetTypeToken);
-	VisitChild(typeRef->mOpenParen);	
+	VisitChild(typeRef->mOpenParen);
 	VisitChild(typeRef->mElementType);
 	VisitChild(typeRef->mCloseParen);
 }
@@ -399,11 +398,11 @@ void BfElementVisitor::Visit(BfModifiedTypeRef * typeRef)
 void BfElementVisitor::Visit(BfArrayTypeRef* typeRef)
 {
 	Visit((BfTypeReference*)typeRef); // Skip the Elemented part so we can put the element in the right spot
-	
+
 	VisitChild(typeRef->mElementType);
 	VisitChild(typeRef->mOpenBracket);
 	for (auto& val : typeRef->mParams)
-		VisitChild(val);	
+		VisitChild(val);
 	VisitChild(typeRef->mCloseBracket);
 }
 
@@ -413,7 +412,7 @@ void BfElementVisitor::Visit(BfGenericInstanceTypeRef* typeRef)
 
 	VisitChild(typeRef->mOpenChevron);
 	for (auto& val : typeRef->mGenericArguments)
-		VisitChild(val);	
+		VisitChild(val);
 	if (typeRef->mCommas.mVals != NULL)
 	{
 		for (auto& val : typeRef->mCommas)
@@ -428,7 +427,7 @@ void BfElementVisitor::Visit(BfTupleTypeRef* typeRef)
 
 	VisitChild(typeRef->mOpenParen);
 	for (auto& val : typeRef->mFieldNames)
-		VisitChild(val);	
+		VisitChild(val);
 	for (auto& val : typeRef->mFieldTypes)
 		VisitChild(val);
 	if (typeRef->mCommas.mVals != NULL)
@@ -535,7 +534,7 @@ void BfElementVisitor::Visit(BfNameOfExpression* nameOfExpr)
 
 	VisitChild(nameOfExpr->mToken);
 	VisitChild(nameOfExpr->mOpenParen);
-	VisitChild(nameOfExpr->mTarget);	
+	VisitChild(nameOfExpr->mTarget);
 	VisitChild(nameOfExpr->mCloseParen);
 }
 
@@ -608,16 +607,16 @@ void BfElementVisitor::Visit(BfLambdaBindExpression* lambdaBindExpr)
 	Visit(lambdaBindExpr->ToBase());
 
 	VisitChild(lambdaBindExpr->mNewToken);
-	
+
 	VisitChild(lambdaBindExpr->mOpenParen);
 	VisitChild(lambdaBindExpr->mCloseParen);
 	for (auto& val : lambdaBindExpr->mParams)
 		VisitChild(val);
 	for (auto& val : lambdaBindExpr->mCommas)
-		VisitChild(val);	
+		VisitChild(val);
 	VisitChild(lambdaBindExpr->mFatArrowToken);
 	VisitChild(lambdaBindExpr->mBody); // Either expression or block
-		
+
 	VisitChild(lambdaBindExpr->mDtor);
 }
 
@@ -627,13 +626,13 @@ void BfElementVisitor::Visit(BfObjectCreateExpression* newExpr)
 
 	VisitChild(newExpr->mNewNode);
 	VisitChild(newExpr->mStarToken);
-	VisitChild(newExpr->mTypeRef);	
+	VisitChild(newExpr->mTypeRef);
 	VisitChild(newExpr->mOpenToken);
-	VisitChild(newExpr->mCloseToken);	
+	VisitChild(newExpr->mCloseToken);
 	for (auto& val : newExpr->mArguments)
 		VisitChild(val);
 	for (auto& val : newExpr->mCommas)
-		VisitChild(val);	
+		VisitChild(val);
 }
 
 void BfElementVisitor::Visit(BfBoxExpression* boxExpr)
@@ -665,7 +664,7 @@ void BfElementVisitor::Visit(BfThrowStatement* throwStmt)
 void BfElementVisitor::Visit(BfDeleteStatement* deleteStmt)
 {
 	Visit(deleteStmt->ToBase());
-	
+
 	VisitChild(deleteStmt->mDeleteToken);
 	VisitChild(deleteStmt->mTargetTypeToken);
 	VisitChild(deleteStmt->mAllocExpr);
@@ -683,7 +682,7 @@ void BfElementVisitor::Visit(BfInvocationExpression* invocationExpr)
 	for (auto& val : invocationExpr->mArguments)
 		VisitChild(val);
 	for (auto& val : invocationExpr->mCommas)
-		VisitChild(val);	
+		VisitChild(val);
 }
 
 void BfElementVisitor::Visit(BfEnumCaseBindExpression* caseBindExpr)
@@ -713,7 +712,7 @@ void BfElementVisitor::Visit(BfSwitchCase* switchCase)
 	for (auto& val : switchCase->mCaseExpressions)
 		VisitChild(val);
 	for (auto& val : switchCase->mCaseCommas)
-		VisitChild(val);	
+		VisitChild(val);
 	VisitChild(switchCase->mColonToken);
 	VisitChild(switchCase->mCodeBlock);
 	VisitChild(switchCase->mEndingToken);
@@ -808,13 +807,13 @@ void BfElementVisitor::Visit(BfDeferStatement* deferStmt)
 	if (deferStmt->mBind != NULL)
 	{
 		auto bind = deferStmt->mBind;
-		
-		VisitChild(bind->mOpenBracket);		
+
+		VisitChild(bind->mOpenBracket);
 		VisitChild(bind->mCloseBracket);
 		for (auto& val : bind->mParams)
 			VisitChild(val);
 		for (auto& val : bind->mCommas)
-			VisitChild(val);				
+			VisitChild(val);
 	}
 
 	VisitChild(deferStmt->mOpenParen);
@@ -849,7 +848,6 @@ void BfElementVisitor::Visit(BfUsingStatement* usingStmt)
 	VisitChild(usingStmt->mVariableDeclaration);
 	VisitChild(usingStmt->mCloseParen);
 	VisitChild(usingStmt->mEmbeddedStatement);
-	
 }
 
 void BfElementVisitor::Visit(BfDoStatement* doStmt)
@@ -857,7 +855,7 @@ void BfElementVisitor::Visit(BfDoStatement* doStmt)
 	Visit(doStmt->ToBase());
 
 	VisitChild(doStmt->mDoToken);
-	VisitChild(doStmt->mEmbeddedStatement);	
+	VisitChild(doStmt->mEmbeddedStatement);
 }
 
 void BfElementVisitor::Visit(BfRepeatStatement* repeatStmt)
@@ -915,14 +913,14 @@ void BfElementVisitor::Visit(BfForStatement* forStmt)
 	for (auto& val : forStmt->mInitializers)
 		VisitChild(val);
 	for (auto& val : forStmt->mInitializerCommas)
-		VisitChild(val);	
+		VisitChild(val);
 	VisitChild(forStmt->mInitializerSemicolon);
 	VisitChild(forStmt->mCondition);
 	VisitChild(forStmt->mConditionSemicolon);
 	for (auto& val : forStmt->mIterators)
 		VisitChild(val);
 	for (auto& val : forStmt->mIteratorCommas)
-		VisitChild(val);	
+		VisitChild(val);
 	VisitChild(forStmt->mCloseParen);
 	VisitChild(forStmt->mEmbeddedStatement);
 }
@@ -982,12 +980,12 @@ void BfElementVisitor::Visit(BfTupleExpression* tupleExpr)
 		{
 			VisitChild(val->mNameNode);
 			VisitChild(val->mColonToken);
-		}		
+		}
 	}
 	for (auto& val : tupleExpr->mValues)
 		VisitChild(val);
 	for (auto& val : tupleExpr->mCommas)
-		VisitChild(val);	
+		VisitChild(val);
 	VisitChild(tupleExpr->mCloseParen);
 }
 
@@ -1006,11 +1004,11 @@ void BfElementVisitor::Visit(BfIndexerExpression* indexerExpr)
 
 	VisitChild(indexerExpr->mTarget);
 	VisitChild(indexerExpr->mOpenBracket);
-	VisitChild(indexerExpr->mCloseBracket);	
+	VisitChild(indexerExpr->mCloseBracket);
 	for (auto& arg : indexerExpr->mArguments)
 		VisitChild(arg);
 	for (auto& comma : indexerExpr->mCommas)
-		VisitChild(comma);	
+		VisitChild(comma);
 }
 
 void BfElementVisitor::Visit(BfUnaryOperatorExpression* binOpExpr)
@@ -1052,11 +1050,11 @@ void BfElementVisitor::Visit(BfMethodDeclaration* methodDeclaration)
 {
 	Visit(methodDeclaration->ToBase());
 
-	VisitChild(methodDeclaration->mAttributes);	
+	VisitChild(methodDeclaration->mAttributes);
 	VisitChild(methodDeclaration->mProtectionSpecifier);
 	VisitChild(methodDeclaration->mReadOnlySpecifier);
 	VisitChild(methodDeclaration->mStaticSpecifier);
-	
+
 	VisitChild(methodDeclaration->mExternSpecifier);
 	VisitChild(methodDeclaration->mVirtualSpecifier); // either 'virtual', 'override', or 'abstract'
 	VisitChild(methodDeclaration->mNewSpecifier);
@@ -1072,7 +1070,7 @@ void BfElementVisitor::Visit(BfMethodDeclaration* methodDeclaration)
 	for (auto& param : methodDeclaration->mParams)
 		VisitChild(param);
 	for (auto& comma : methodDeclaration->mCommas)
-		VisitChild(comma);	
+		VisitChild(comma);
 	VisitChild(methodDeclaration->mCloseParen);
 	VisitChild(methodDeclaration->mGenericParams);
 	VisitChild(methodDeclaration->mGenericConstraintsDeclaration);
@@ -1109,26 +1107,26 @@ void BfElementVisitor::Visit(BfPropertyBodyExpression* propertyBodyExpression)
 	Visit(propertyBodyExpression->ToBase());
 
 	VisitChild(propertyBodyExpression->mMutSpecifier);
-	VisitChild(propertyBodyExpression->mFatTokenArrow);	
+	VisitChild(propertyBodyExpression->mFatTokenArrow);
 }
 
 void BfElementVisitor::Visit(BfPropertyDeclaration* propertyDeclaration)
 {
 	Visit(propertyDeclaration->ToBase());
 
-	VisitChild(propertyDeclaration->mAttributes);	
+	VisitChild(propertyDeclaration->mAttributes);
 	VisitChild(propertyDeclaration->mProtectionSpecifier);
 	VisitChild(propertyDeclaration->mStaticSpecifier);
 
 	VisitChild(propertyDeclaration->mVirtualSpecifier); // either 'virtual', 'override', or 'abstract'
 	VisitChild(propertyDeclaration->mExplicitInterface);
 	VisitChild(propertyDeclaration->mExplicitInterfaceDotToken);
-	
+
 	if (auto block = BfNodeDynCast<BfBlock>(propertyDeclaration->mDefinitionBlock))
 	{
 		VisitChild(block->mOpenBrace);
 		for (auto& method : propertyDeclaration->mMethods)
-			VisitChild(method);		
+			VisitChild(method);
 		VisitChild(block->mCloseBrace);
 	}
 	else
@@ -1156,7 +1154,7 @@ void BfElementVisitor::Visit(BfFieldDeclaration* fieldDeclaration)
 {
 	Visit(fieldDeclaration->ToBase());
 
-	VisitChild(fieldDeclaration->mAttributes);	
+	VisitChild(fieldDeclaration->mAttributes);
 	VisitChild(fieldDeclaration->mProtectionSpecifier);
 	VisitChild(fieldDeclaration->mStaticSpecifier);
 
@@ -1181,7 +1179,7 @@ void BfElementVisitor::Visit(BfEnumCaseDeclaration* enumCaseDeclaration)
 	for (auto& entry : enumCaseDeclaration->mEntries)
 		VisitChild(entry);
 	for (auto& comma : enumCaseDeclaration->mCommas)
-		VisitChild(comma);	
+		VisitChild(comma);
 }
 
 void BfElementVisitor::Visit(BfFieldDtorDeclaration* fieldDtorDeclaration)
@@ -1199,7 +1197,7 @@ void BfElementVisitor::Visit(BfTypeDeclaration* typeDeclaration)
 
 	VisitChild(typeDeclaration->mAttributes);
 	VisitChild(typeDeclaration->mAbstractSpecifier);
-	VisitChild(typeDeclaration->mSealedSpecifier);	
+	VisitChild(typeDeclaration->mSealedSpecifier);
 	VisitChild(typeDeclaration->mProtectionSpecifier);
 	VisitChild(typeDeclaration->mStaticSpecifier);
 	VisitChild(typeDeclaration->mPartialSpecifier);
@@ -1210,7 +1208,7 @@ void BfElementVisitor::Visit(BfTypeDeclaration* typeDeclaration)
 	for (auto& baseClass : typeDeclaration->mBaseClasses)
 		VisitChild(baseClass);
 	for (auto& comma : typeDeclaration->mBaseClassCommas)
-		VisitChild(comma);	
+		VisitChild(comma);
 
 	VisitChild(typeDeclaration->mGenericParams);
 	VisitChild(typeDeclaration->mGenericConstraintsDeclaration);
@@ -1221,7 +1219,6 @@ void BfElementVisitor::Visit(BfTypeDeclaration* typeDeclaration)
 		for (auto& member : *typeDeclaration->mDefineBlock)
 			VisitChild(member);
 	}*/
-	
 }
 
 void BfElementVisitor::Visit(BfTypeAliasDeclaration* typeDeclaration)
@@ -1237,7 +1234,7 @@ void BfElementVisitor::Visit(BfUsingDirective* usingDirective)
 {
 	Visit(usingDirective->ToBase());
 
-	VisitChild(usingDirective->mUsingToken);	
+	VisitChild(usingDirective->mUsingToken);
 	VisitChild(usingDirective->mNamespace);
 }
 

+ 4 - 4
IDEHelper/Compiler/BfElementVisitor.h

@@ -48,7 +48,7 @@ public:
 	virtual void Visit(BfMixinExpression* thisExpr);
 	virtual void Visit(BfSizedArrayCreateExpression* createExpr);
 	virtual void Visit(BfInitializerExpression* initExpr);
-	virtual void Visit(BfCollectionInitializerExpression* collectionInitExpr);	
+	virtual void Visit(BfCollectionInitializerExpression* collectionInitExpr);
 	virtual void Visit(BfTypeReference* typeRef);
 	virtual void Visit(BfNamedTypeReference* typeRef);
 	virtual void Visit(BfQualifiedTypeReference* qualifiedType);
@@ -69,8 +69,8 @@ public:
 	virtual void Visit(BfNullableTypeRef* typeRef);
 	virtual void Visit(BfVariableDeclaration* varDecl);
 	virtual void Visit(BfLocalMethodDeclaration* methodDecl);
-	virtual void Visit(BfParameterDeclaration* paramDecl);		
-	virtual void Visit(BfTypeAttrExpression* typeAttrExpr);		
+	virtual void Visit(BfParameterDeclaration* paramDecl);
+	virtual void Visit(BfTypeAttrExpression* typeAttrExpr);
 	virtual void Visit(BfOffsetOfExpression* offsetOfExpr);
 	virtual void Visit(BfNameOfExpression* nameOfExpr);
 	virtual void Visit(BfDefaultExpression* defaultExpr);
@@ -85,7 +85,7 @@ public:
 	virtual void Visit(BfBoxExpression* boxExpr);
 	virtual void Visit(BfScopedInvocationTarget* scopedTarget);
 	virtual void Visit(BfInvocationExpression* invocationExpr);
-	virtual void Visit(BfDeferStatement* deferStmt);	
+	virtual void Visit(BfDeferStatement* deferStmt);
 	virtual void Visit(BfEnumCaseBindExpression* caseBindExpr);
 	virtual void Visit(BfCaseExpression* caseExpr);
 	virtual void Visit(BfSwitchCase* switchCase);

+ 1 - 39
IDEHelper/Compiler/BfExprEvaluator.cpp

@@ -762,7 +762,6 @@ void BfMethodMatcher::CompareMethods(BfMethodInstance* prevMethodInstance, BfTyp
 		return;
 	}
 
-
 	if (newMethodDef->mExplicitInterface != prevMethodDef->mExplicitInterface)
 	{
 		if (mModule->CompareMethodSignatures(newMethodInstance, prevMethodInstance))
@@ -1594,7 +1593,6 @@ bool BfMethodMatcher::InferFromGenericConstraints(BfMethodInstance* methodInstan
 
 			if (checkOpConstraint.mCastToken == BfToken_Implicit)
 			{
-
 			}
 			else
 			{
@@ -1603,7 +1601,6 @@ bool BfMethodMatcher::InferFromGenericConstraints(BfMethodInstance* methodInstan
 
 				if (checkOpConstraint.mCastToken == BfToken_Explicit)
 				{
-
 				}
 				else
 				{
@@ -1755,7 +1752,6 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
 		}
 	}
 
-
 	if (mHasArgNames)
 	{
 		checkMethod->BuildParamNameMap();
@@ -1788,7 +1784,6 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
 		}
 	}
 
-
 	for (auto& checkGenericArgRef : mCheckMethodGenericArguments)
 		checkGenericArgRef = NULL;
 
@@ -3068,7 +3063,6 @@ void BfMethodMatcher::TryDevirtualizeCall(BfTypedValue target, BfTypedValue* ori
 					// Failed
 					mFakeConcreteTarget = true;
 				}
-
 			}
 		}
 	}
@@ -3796,7 +3790,6 @@ void BfExprEvaluator::Visit(BfCaseExpression* caseExpr)
 
 		if (mResult)
 			return;
-
 	}
 
 	if ((caseValAddr) && (IsVar(caseValAddr.mType)))
@@ -5523,7 +5516,6 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
 	else
 		findName.Reference(fieldName);
 
-
 	auto activeTypeDef = mModule->GetActiveTypeDef();
 	for (int pass = 0; pass < 2; pass++)
 	{
@@ -6990,8 +6982,6 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, BfMethodInstance*
 	return result;
 }
 
-
-
 BfTypedValue BfExprEvaluator::CreateCall(BfMethodMatcher* methodMatcher, BfTypedValue target)
 {
 	auto moduleMethodInstance = GetSelectedMethod(*methodMatcher);
@@ -7273,7 +7263,6 @@ void BfExprEvaluator::PushThis(BfAstNode* targetSrc, BfTypedValue argVal, BfMeth
 				}
 			}
 		}
-
 	}
 
 	if (argVal.mType->IsValuelessType())
@@ -7921,7 +7910,6 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
 					mModule->Warn(BfWarning_BF4205_StringInterpolationParam, "Expanded string interpolation argument not used as 'params'. If string allocation was intended then consider adding a specifier such as 'scope'.", errorRef);
 				}
 
-
 // 				if ((arg == NULL) && (argValues[argExprIdx].mExpression != NULL))
 // 					hadMissingArg = true;
 
@@ -8009,7 +7997,6 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
 					if (auto typerDecl = BfNodeDynCast<BfTypeDeclaration>(mModule->mParentNodeEntry->mNode))
 						showCtorError = true;
 
-
 					if (showCtorError)
 					{
 						if (mModule->PreFail())
@@ -8848,7 +8835,6 @@ BfTypedValue BfExprEvaluator::ResolveArgValue(BfResolvedArg& resolvedArg, BfType
 			}
 		}
 
-
 		if (wantType->IsRef())
 		{
 			auto refType = (BfRefType*)wantType;
@@ -9587,7 +9573,6 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
 			else if (isUnboundCall)
 			{
 				//auto resolvedType = mModule->ResolveGenericType(lookupType);
-
 			}
 			else if (lookupType->IsGenericParam())
 			{
@@ -9869,7 +9854,6 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
 				if (resolvedType != NULL)
 					resolvedTypeInstance = resolvedType->ToTypeInstance();
 			}
-
 		}
 		else
 		{
@@ -10198,7 +10182,6 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
 
 	if (methodDef == NULL)
 	{
-
 	}
 
 	// This will flush out any new ambiguity errors from extension methods
@@ -10587,7 +10570,6 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
 			mModule->MethodToString(moduleMethodInstance.mMethodInstance).c_str(), mModule->MethodToString(mModule->mCurMethodInstance).c_str()), targetSrc);
 	}
 
-
 	BfTypedValue result;
 	BfTypedValue argCascade;
 
@@ -10950,7 +10932,6 @@ void BfExprEvaluator::LookupQualifiedName(BfAstNode* nameNode, BfIdentifierNode*
 	{
 		if (mResult.mType->IsSizedArray())
 		{
-
 			if (mResult.mType->IsValuelessType())
 			{
 				mResult.mType = mModule->GetWrappedStructType(mResult.mType);
@@ -12935,7 +12916,6 @@ BfTypedValue BfExprEvaluator::DoImplicitArgCapture(BfAstNode* refNode, BfIdentif
 			BfLocalVarEntry* entry;
 			if (checkMethodState->mLocalVarSet.TryGetWith<StringImpl&>(findName, &entry))
 			{
-
 				auto varDecl = entry->mLocalVar;
 
 				while (varDecl != NULL)
@@ -12961,7 +12941,6 @@ BfTypedValue BfExprEvaluator::DoImplicitArgCapture(BfAstNode* refNode, BfIdentif
 
 					varDecl = varDecl->mShadowedLocal;
 				}
-
 			}
 
 			// Check for the captured locals.  It's important we do it here so we get local-first precedence still
@@ -13233,7 +13212,6 @@ void BfExprEvaluator::Visit(BfDelegateBindExpression* delegateBindExpr)
 		else
 			delegateTypeInstance = mExpectingType->ToTypeInstance();
 
-
 		if ((delegateTypeInstance == NULL) ||
 			((!delegateTypeInstance->IsDelegate()) && (!delegateTypeInstance->IsFunction())))
 		{
@@ -14713,7 +14691,6 @@ BfLambdaInstance* BfExprEvaluator::GetLambdaInstance(BfLambdaBindExpression* lam
 	mModule->mBfIRBuilder->PopulateType(useTypeInstance);
 	mModule->PopulateType(useTypeInstance);
 
-
 	methodDef->mIsStatic = closureTypeInst == NULL;
 
 	SizedArray<BfIRType, 8> origParamTypes;
@@ -14860,7 +14837,6 @@ BfLambdaInstance* BfExprEvaluator::GetLambdaInstance(BfLambdaBindExpression* lam
 	mModule->mBfIRBuilder->SaveDebugLocation();
 	//
 	{
-
 		BfGetSymbolReferenceKind prevSymbolRefKind = BfGetSymbolReferenceKind_None;
 		if (mModule->mCompiler->mResolvePassData != NULL)
 		{
@@ -15642,7 +15618,6 @@ void BfExprEvaluator::CreateObject(BfObjectCreateExpression* objCreateExpr, BfAs
 			BfInitContext(BfModule* module, BfType* resultType, int dimensions, SizedArray<BfIRValue, 2>& dimLengthVals, BfIRValue arraySize, int& writeIdx) :
 				mModule(module), resultType(resultType), dimensions(dimensions), dimLengthVals(dimLengthVals), arraySize(arraySize), writeIdx(writeIdx)
 			{
-
 			}
 
 			void Handle(BfIRValue addr, int curDim, const BfSizedArray<BfExpression*>& valueExprs)
@@ -16160,7 +16135,6 @@ void BfExprEvaluator::CreateObject(BfObjectCreateExpression* objCreateExpr, BfAs
 
 	/*if (typeInstance != NULL)
 	{
-
 		mModule->InitTypeInst(mResult, scopeData, true);
 	}
 	if (isStackAlloc)
@@ -18089,11 +18063,9 @@ void BfExprEvaluator::DoInvocation(BfAstNode* target, BfMethodBoundExpression* m
 			{
 				if (mExpectingType->IsVar())
 				{
-
 				}
 
 				mResult = BfTypedValue(mExpectingType);
-
 			}
 			else if (!gaveUnqualifiedDotError)
 				mModule->Fail("Unqualified dot syntax can only be used when the result type can be inferred", memberRefExpression->mDotToken);
@@ -18135,7 +18107,6 @@ void BfExprEvaluator::DoInvocation(BfAstNode* target, BfMethodBoundExpression* m
 					thisValue = mResult;
 					mResult = BfTypedValue();
 				}
-
 			}
 			if (mPropDef != NULL)
 				thisValue = GetResult(true);
@@ -18220,7 +18191,6 @@ void BfExprEvaluator::DoInvocation(BfAstNode* target, BfMethodBoundExpression* m
 						flags = (BfEvalExprFlags)(flags | BfEvalExprFlags_AllowRefExpr);
 						expr = paranExpr->mExpression;
 					}
-
 				}
 				if (expr != NULL)
 					mResult = mModule->CreateValueFromExpression(expr, expectingTargetType, flags);
@@ -18349,7 +18319,6 @@ void BfExprEvaluator::DoInvocation(BfAstNode* target, BfMethodBoundExpression* m
 					mResult = BfTypedValue();
 				}
 			}
-
 		}
 		if (mPropDef != NULL)
 			thisValue = GetResult(true);
@@ -18940,7 +18909,6 @@ BfMethodDef* BfExprEvaluator::GetPropertyMethodDef(BfPropertyDef* propDef, BfMet
 		if (methodDef->mMethodType != methodType)
 			continue;
 
-
 		if (methodDef->mCheckedKind == checkedKind)
 		{
 			matchedMethod = methodDef;
@@ -19623,8 +19591,6 @@ bool BfExprEvaluator::CheckModifyResult(BfTypedValue& typedVal, BfAstNode* refNo
 								break;
 							}
 						}
-
-
 					}
 				}
 
@@ -20098,7 +20064,6 @@ BfTypedValue BfExprEvaluator::PerformAssignment_CheckOp(BfAssignmentExpression*
 			return leftValue;
 		}
 
-
 		checkTypeInst = mModule->GetBaseType(checkTypeInst);
 	}
 
@@ -21945,7 +21910,6 @@ void BfExprEvaluator::Visit(BfIndexerExpression* indexerExpr)
 			}
 			else
 			{
-
 				auto indexResult = mModule->CreateIndexedValue(underlyingType, target.mValue, indexArgument.mValue);
 				mResult = BfTypedValue(indexResult, underlyingType, target.IsReadOnly() ? BfTypedValueKind_ReadOnlyAddr : BfTypedValueKind_Addr);
 			}
@@ -22037,7 +22001,6 @@ void BfExprEvaluator::PerformUnaryOperation(BfExpression* unaryOpExpr, BfUnaryOp
 		mExpectingType = prevExpedcting;
 	}
 
-
 	BfExprEvaluator::PerformUnaryOperation_OnResult(unaryOpExpr, unaryOp, opToken, opFlags);
 }
 
@@ -22998,7 +22961,6 @@ bool BfExprEvaluator::PerformBinaryOperation_NullCoalesce(BfTokenNode* opToken,
 		mModule->AddBasicBlock(rhsBB);
 		BfTypedValue rightValue;
 
-
 		if (assignTo != NULL)
 			rightValue = mModule->CreateValueFromExpression(rightExpression, wantType, (BfEvalExprFlags)((mBfEvalExprFlags & BfEvalExprFlags_InheritFlags) | BfEvalExprFlags_CreateConditionalScope));
 		else
@@ -25079,4 +25041,4 @@ void BfExprEvaluator::Visit(BfBinaryOperatorExpression* binOpExpr)
 	}
 
 	PerformBinaryOperation(binOpExpr->mLeft, binOpExpr->mRight, binOpExpr->mOp, binOpExpr->mOpToken, BfBinOpFlag_None);
-}
+}

+ 61 - 62
IDEHelper/Compiler/BfExprEvaluator.h

@@ -7,7 +7,7 @@ NS_BF_BEGIN
 
 enum BfArgFlags
 {
-	BfArgFlag_None = 0,	
+	BfArgFlag_None = 0,
 	BfArgFlag_DelegateBindAttempt = 1,
 	BfArgFlag_LambdaBindAttempt = 2,
 	BfArgFlag_UnqualifiedDotAttempt = 4,
@@ -62,7 +62,7 @@ public:
 	BfIdentifierNode* mNameNode;
 	BfType* mResolvedType;
 	BfAstNode* mExpression;
-	BfArgFlags mArgFlags;	
+	BfArgFlags mArgFlags;
 	BfType* mExpectedType;
 	BfType* mBestBoundType;
 	bool mWantsRecalc;
@@ -87,10 +87,10 @@ public:
 
 struct BfResolvedArgs
 {
-	SizedArray<BfResolvedArg, 4> mResolvedArgs;	
+	SizedArray<BfResolvedArg, 4> mResolvedArgs;
 	BfTokenNode* mOpenToken;
 	const BfSizedArray<BfExpression*>* mArguments;
-	const BfSizedArray<BfTokenNode*>* mCommas;	
+	const BfSizedArray<BfTokenNode*>* mCommas;
 	BfTokenNode* mCloseToken;
 
 public:
@@ -134,8 +134,7 @@ public:
 		mCloseToken = NULL;
 	}
 
-	void HandleFixits(BfModule* module);	
-	
+	void HandleFixits(BfModule* module);
 };
 
 class BfGenericInferContext
@@ -145,13 +144,13 @@ public:
 	BfModule* mModule;
 	BfTypeVector* mCheckMethodGenericArguments;
 	SizedArray<BfIRValue, 4> mPrevArgValues;
-	int mInferredCount;	
+	int mInferredCount;
 
 public:
 	BfGenericInferContext()
 	{
 		mModule = NULL;
-		mInferredCount = 0;		
+		mInferredCount = 0;
 	}
 
 	bool AddToCheckedSet(BfType* argType, BfType* wantType);
@@ -166,13 +165,13 @@ public:
 
 struct BfMethodGenericArguments
 {
-	BfSizedArray<BfAstNode*>* mArguments;	
+	BfSizedArray<BfAstNode*>* mArguments;
 	bool mIsPartial;
 	bool mIsOpen; // Ends with ...
 
 	BfMethodGenericArguments()
 	{
-		mArguments = NULL;		
+		mArguments = NULL;
 		mIsPartial = false;
 		mIsOpen = false;
 	}
@@ -198,17 +197,17 @@ public:
 	{
 		BackupMatchKind_None,
 		BackupMatchKind_TooManyArgs,
-		BackupMatchKind_EarlyMismatch,		
+		BackupMatchKind_EarlyMismatch,
 		BackupMatchKind_PartialLastArgMatch
 	};
-	
+
 public:
 	BfAstNode* mTargetSrc;
 	BfTypedValue mTarget;
 	BfTypedValue mOrigTarget;
 	BfModule* mModule;
 	BfTypeDef* mActiveTypeDef;
-	String mMethodName;	
+	String mMethodName;
 	BfMethodInstance* mInterfaceMethodInstance;
 	SizedArrayImpl<BfResolvedArg>& mArguments;
 	BfType* mCheckReturnType;
@@ -216,32 +215,32 @@ public:
 	BfCheckedKind mCheckedKind;
 	Array<SizedArray<BfUsingFieldData::MemberRef, 1>*>* mUsingLists;
 	bool mHasArgNames;
-	bool mHadExplicitGenericArguments;	
+	bool mHadExplicitGenericArguments;
 	bool mHadOpenGenericArguments;
 	bool mHadPartialGenericArguments;
-	bool mHasVarArguments;	
+	bool mHasVarArguments;
 	bool mHadVarConflictingReturnType;
 	bool mBypassVirtual;
 	bool mAllowImplicitThis;
 	bool mAllowImplicitRef;
 	bool mAllowImplicitWrap;
 	bool mAllowStatic;
-	bool mAllowNonStatic;	
-	bool mSkipImplicitParams;	
+	bool mAllowNonStatic;
+	bool mSkipImplicitParams;
 	bool mAutoFlushAmbiguityErrors;
 	BfEvalExprFlags mBfEvalExprFlags;
-	int mMethodCheckCount;	
-	BfType* mExplicitInterfaceCheck;	
+	int mMethodCheckCount;
+	BfType* mExplicitInterfaceCheck;
 	MatchFailKind mMatchFailKind;
-		
-	BfTypeVector mCheckMethodGenericArguments;		
+
+	BfTypeVector mCheckMethodGenericArguments;
 
 	BfType* mSelfType; // Only when matching interfaces when 'Self' needs to refer back to the implementing type
 	BfMethodDef* mBackupMethodDef;
-	BackupMatchKind mBackupMatchKind;	
+	BackupMatchKind mBackupMatchKind;
 	int mBackupArgMatchCount;
 	BfMethodDef* mBestMethodDef;
-	BfTypeInstance* mBestMethodTypeInstance;		
+	BfTypeInstance* mBestMethodTypeInstance;
 	BfMethodInstance* mBestRawMethodInstance;
 	BfModuleMethodInstance mBestMethodInstance;
 	SizedArray<int, 4> mBestMethodGenericArgumentSrcs;
@@ -254,9 +253,9 @@ public:
 	BfTypedValue ResolveArgTypedValue(BfResolvedArg& resolvedArg, BfType* checkType, BfTypeVector* genericArgumentsSubstitute, BfType *origCheckType = NULL, BfResolveArgFlags flags = BfResolveArgFlag_None);
 	bool InferFromGenericConstraints(BfMethodInstance* methodInstance, BfGenericParamInstance* genericParamInst, BfTypeVector* methodGenericArgs);
 	void CompareMethods(BfMethodInstance* prevMethodInstance, BfTypeVector* prevGenericArgumentsSubstitute,
-		BfMethodInstance* newMethodInstance, BfTypeVector* genericArgumentsSubstitute, 
+		BfMethodInstance* newMethodInstance, BfTypeVector* genericArgumentsSubstitute,
 		bool* outNewIsBetter, bool* outNewIsWorse, bool allowSpecializeFail);
-	void FlushAmbiguityError();		
+	void FlushAmbiguityError();
 	bool IsType(BfTypedValue& val, BfType* type);
 	int GetMostSpecificType(BfType* lhs, BfType* rhs); // 0, 1, or -1
 
@@ -317,8 +316,8 @@ class BfFunctionBindResult
 {
 public:
 	BfTypedValue mOrigTarget;
-	BfTypedValue mTarget;	
-	BfIRValue mFunc;	
+	BfTypedValue mTarget;
+	BfIRValue mFunc;
 	BfMethodInstance* mMethodInstance;
 	BfType* mBindType;
 	bool mSkipThis;
@@ -329,7 +328,7 @@ public:
 
 public:
 	BfFunctionBindResult()
-	{				
+	{
 		mMethodInstance = NULL;
 		mBindType = NULL;
 		mSkipMutCheck = false;
@@ -342,7 +341,7 @@ public:
 struct DeferredTupleAssignData
 {
 	struct Entry
-	{		
+	{
 		BfExpression* mExpr;
 		BfType* mVarType;
 		BfAstNode* mVarNameNode;
@@ -359,8 +358,8 @@ struct DeferredTupleAssignData
 enum BfImplicitParamKind
 {
 	BfImplicitParamKind_General,
-	BfImplicitParamKind_GenericMethodMember,	
-	BfImplicitParamKind_GenericTypeMember,	
+	BfImplicitParamKind_GenericMethodMember,
+	BfImplicitParamKind_GenericTypeMember,
 	BfImplicitParamKind_GenericTypeMember_Addr,
 };
 
@@ -409,11 +408,11 @@ public:
 	BfGetMethodInstanceFlags mPropGetMethodFlags;
 	BfCheckedKind mPropCheckedKind;
 	BfPropertyDef* mPropDef;
-	BfType* mExpectingType;		
+	BfType* mExpectingType;
 	BfAttributeState* mPrefixedAttributeState;
-	BfTypedValue* mReceivingValue;	
+	BfTypedValue* mReceivingValue;
 	BfFunctionBindResult* mFunctionBindResult;
-	SizedArray<BfResolvedArg, 2> mIndexerValues;	
+	SizedArray<BfResolvedArg, 2> mIndexerValues;
 	BfAstNode* mDeferCallRef;
 	BfScopeData* mDeferScopeAlloc;
 	bool mUsedAsStatement;
@@ -434,18 +433,18 @@ public:
 	bool CheckForMethodName(BfAstNode* refNode, BfTypeInstance* typeInst, const StringImpl& findName);
 	bool IsVar(BfType* type, bool forceIgnoreWrites = false);
 	void GetLiteral(BfAstNode* refNode, const BfVariant& variant);
-	void FinishExpressionResult();	
-	virtual bool CheckAllowValue(const BfTypedValue& typedValue, BfAstNode* refNode);	
-	BfAutoComplete* GetAutoComplete();	
+	void FinishExpressionResult();
+	virtual bool CheckAllowValue(const BfTypedValue& typedValue, BfAstNode* refNode);
+	BfAutoComplete* GetAutoComplete();
 	bool IsComptime();
 	bool IsConstEval();
 	bool IsComptimeEntry();
 	int GetStructRetIdx(BfMethodInstance* methodInstance, bool forceStatic = false);
 	BfTypedValue SetupNullConditional(BfTypedValue target, BfTokenNode* dotToken);
-	void Evaluate(BfAstNode* astNode, bool propogateNullConditional = false, bool ignoreNullConditional = false, bool allowSplat = true);	
+	void Evaluate(BfAstNode* astNode, bool propogateNullConditional = false, bool ignoreNullConditional = false, bool allowSplat = true);
 	BfType* BindGenericType(BfAstNode* node, BfType* bindType);
 	BfType* ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType populateType = BfPopulateType_Data, BfResolveTypeRefFlags resolveFlags = (BfResolveTypeRefFlags)0);
-	void ResolveGenericType();	
+	void ResolveGenericType();
 	void ResolveArgValues(BfResolvedArgs& resolvedArgs, BfResolveArgsFlags flags = BfResolveArgsFlag_None);
 	void ResolveAllocTarget(BfAllocTarget& allocTarget, BfAstNode* newNode, BfTokenNode*& newToken, BfCustomAttributes** outCustomAttributes = NULL);
 	BfTypedValue ResolveArgValue(BfResolvedArg& resolvedArg, BfType* wantType, BfTypedValue* receivingValue = NULL, BfParamKind paramKind = BfParamKind_Normal, BfIdentifierNode* paramNameNode = NULL);
@@ -453,21 +452,21 @@ public:
 	BfModuleMethodInstance GetPropertyMethodInstance(BfMethodDef* methodDef);
 	void CheckPropFail(BfMethodDef* propMethodDef, BfMethodInstance* methodInstance, bool checkProt);
 	bool HasResult();
-	BfTypedValue GetResult(bool clearResult = false, bool resolveGenericType = false);				
+	BfTypedValue GetResult(bool clearResult = false, bool resolveGenericType = false);
 	void CheckResultForReading(BfTypedValue& typedValue);
 	void MarkResultUsed();
 	void MarkResultAssigned();
-	void MakeResultAsValue();	
+	void MakeResultAsValue();
 	bool CheckIsBase(BfAstNode* checkNode);
 	bool CheckModifyResult(BfTypedValue& typeValue, BfAstNode* refNode, const char* modifyType, bool onlyNeedsMut = false, bool emitWarning = false, bool skipCopyOnMutate = false);
 	bool CheckGenericCtor(BfGenericParamType* genericParamType, BfResolvedArgs& argValues, BfAstNode* targetSrc);
 	BfTypedValue LoadProperty(BfAstNode* targetSrc, BfTypedValue target, BfTypeInstance* typeInstance, BfPropertyDef* prop, BfLookupFieldFlags flags, BfCheckedKind checkedKind, bool isInline);
 	BfTypedValue LoadField(BfAstNode* targetSrc, BfTypedValue target, BfTypeInstance* typeInstance, BfFieldDef* fieldDef, BfLookupFieldFlags flags);
-	BfTypedValue LookupField(BfAstNode* targetSrc, BfTypedValue target, const StringImpl& fieldName, BfLookupFieldFlags flags = BfLookupFieldFlag_None);	
+	BfTypedValue LookupField(BfAstNode* targetSrc, BfTypedValue target, const StringImpl& fieldName, BfLookupFieldFlags flags = BfLookupFieldFlag_None);
 	void CheckObjectCreateTypeRef(BfType* expectingType, BfAstNode* afterNode);
 	void LookupQualifiedName(BfQualifiedNameNode* nameNode, bool ignoreInitialError = false, bool* hadError = NULL);
 	void LookupQualifiedName(BfAstNode* nameNode, BfIdentifierNode* nameLeft, BfIdentifierNode* nameRight, bool ignoreInitialError, bool* hadError = NULL);
-	void LookupQualifiedStaticField(BfQualifiedNameNode* nameNode, bool ignoreIdentifierNotFoundError);	
+	void LookupQualifiedStaticField(BfQualifiedNameNode* nameNode, bool ignoreIdentifierNotFoundError);
 	void LookupQualifiedStaticField(BfAstNode* nameNode, BfIdentifierNode* nameLeft, BfIdentifierNode* nameRight, bool ignoreIdentifierNotFoundError);
 	bool CheckConstCompare(BfBinaryOp binaryOp, BfAstNode* opToken, const BfTypedValue& leftValue, const BfTypedValue& rightValue);
 	void AddStrings(const BfTypedValue& leftValue, const BfTypedValue& rightValue, BfAstNode* refNode);
@@ -489,41 +488,41 @@ public:
 	void SplatArgs(BfTypedValue value, SizedArrayImpl<BfIRValue>& irArgs);
 	void PushArg(BfTypedValue argVal, SizedArrayImpl<BfIRValue>& irArgs, bool disableSplat = false, bool disableLowering = false, bool isIntrinsic = false, bool createCompositeCopy = false);
 	void PushThis(BfAstNode* targetSrc, BfTypedValue callTarget, BfMethodInstance* methodInstance, SizedArrayImpl<BfIRValue>& irArgs, bool skipMutCheck = false);
-	BfTypedValue MatchConstructor(BfAstNode* targetSrc, BfMethodBoundExpression* methodBoundExpr, BfTypedValue target, BfTypeInstance* targetType, 
+	BfTypedValue MatchConstructor(BfAstNode* targetSrc, BfMethodBoundExpression* methodBoundExpr, BfTypedValue target, BfTypeInstance* targetType,
 		BfResolvedArgs& argValues, bool callCtorBodyOnly, bool allowAppendAlloc, BfTypedValue* appendIndexValue = NULL);
 	BfTypedValue CheckEnumCreation(BfAstNode* targetSrc, BfTypeInstance* enumType, const StringImpl& caseName, BfResolvedArgs& argValues);
-	BfTypedValue MatchMethod(BfAstNode* targetSrc, BfMethodBoundExpression* methodBoundExpr, BfTypedValue target, bool allowImplicitThis, bool bypassVirtual, const StringImpl& name, 
+	BfTypedValue MatchMethod(BfAstNode* targetSrc, BfMethodBoundExpression* methodBoundExpr, BfTypedValue target, bool allowImplicitThis, bool bypassVirtual, const StringImpl& name,
 		BfResolvedArgs& argValue, const BfMethodGenericArguments& methodGenericArguments, BfCheckedKind checkedKind = BfCheckedKind_NotSet);
-	BfTypedValue MakeCallableTarget(BfAstNode* targetSrc, BfTypedValue target);		
+	BfTypedValue MakeCallableTarget(BfAstNode* targetSrc, BfTypedValue target);
 	BfModuleMethodInstance GetSelectedMethod(BfAstNode* targetSrc, BfTypeInstance* curTypeInst, BfMethodDef* methodDef, BfMethodMatcher& methodMatcher, BfType** overrideReturnType = NULL);
 	BfModuleMethodInstance GetSelectedMethod(BfMethodMatcher& methodMatcher);
 	bool CheckVariableDeclaration(BfAstNode* checkNode, bool requireSimpleIfExpr, bool exprMustBeTrue, bool silentFail);
 	bool HasVariableDeclaration(BfAstNode* checkNode);
-	void DoInvocation(BfAstNode* target, BfMethodBoundExpression* methodBoundExpr, const BfSizedArray<BfExpression*>& args, const BfMethodGenericArguments& methodGenericArgs, BfTypedValue* outCascadeValue = NULL);	
-	int GetMixinVariable();	
+	void DoInvocation(BfAstNode* target, BfMethodBoundExpression* methodBoundExpr, const BfSizedArray<BfExpression*>& args, const BfMethodGenericArguments& methodGenericArgs, BfTypedValue* outCascadeValue = NULL);
+	int GetMixinVariable();
 	void CheckLocalMethods(BfAstNode* targetSrc, BfTypeInstance* typeInstance, const StringImpl& methodName, BfMethodMatcher& methodMatcher, BfMethodType methodType);
 	void InjectMixin(BfAstNode* targetSrc, BfTypedValue target, bool allowImplicitThis, const StringImpl& name, const BfSizedArray<BfExpression*>& arguments, const BfMethodGenericArguments& methodGenericArgs);
 	void SetMethodElementType(BfAstNode* target);
 	BfTypedValue DoImplicitArgCapture(BfAstNode* refNode, BfIdentifierNode* identifierNode, int shadowIdx);
 	BfTypedValue DoImplicitArgCapture(BfAstNode* refNode, BfMethodInstance* methodInstance, int paramIdx, bool& failed, BfImplicitParamKind paramKind = BfImplicitParamKind_General, const BfTypedValue& methodRefTarget = BfTypedValue());
 	bool CanBindDelegate(BfDelegateBindExpression* delegateBindExpr, BfMethodInstance** boundMethod = NULL, BfType* origMethodExpectingType = NULL, BfTypeVector* methodGenericArgumentsSubstitute = NULL);
-	bool IsExactMethodMatch(BfMethodInstance* methodA, BfMethodInstance* methodB, bool ignoreImplicitParams = false);		
-	BfTypeInstance* VerifyBaseDelegateType(BfTypeInstance* delegateType);	
+	bool IsExactMethodMatch(BfMethodInstance* methodA, BfMethodInstance* methodB, bool ignoreImplicitParams = false);
+	BfTypeInstance* VerifyBaseDelegateType(BfTypeInstance* delegateType);
 	void ConstResolve(BfExpression* expr);
 	void ProcessArrayInitializer(BfTokenNode* openToken, const BfSizedArray<BfExpression*>& values, const BfSizedArray<BfTokenNode*>& commas, BfTokenNode* closeToken, int dimensions, SizedArrayImpl<int64>& dimLengths, int dim, bool& hasFailed);
 	BfLambdaInstance* GetLambdaInstance(BfLambdaBindExpression* lambdaBindExpr, BfAllocTarget& allocTarget);
-	void VisitLambdaBodies(BfAstNode* body, BfFieldDtorDeclaration* fieldDtor);	
-	void FixitAddMember(BfTypeInstance* typeInst, BfType* fieldType, const StringImpl& fieldName, bool isStatic);	
+	void VisitLambdaBodies(BfAstNode* body, BfFieldDtorDeclaration* fieldDtor);
+	void FixitAddMember(BfTypeInstance* typeInst, BfType* fieldType, const StringImpl& fieldName, bool isStatic);
 	BfTypedValue TryArrowLookup(BfTypedValue typedValue, BfTokenNode* arrowToken);
 	void PerformUnaryOperation(BfExpression* unaryOpExpr, BfUnaryOp unaryOp, BfTokenNode* opToken, BfUnaryOpFlags opFlags);
 	BfTypedValue PerformUnaryOperation_TryOperator(const BfTypedValue& inValue, BfExpression* unaryOpExpr, BfUnaryOp unaryOp, BfTokenNode* opToken, BfUnaryOpFlags opFlags);
-	void PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr, BfUnaryOp unaryOp, BfTokenNode* opToken, BfUnaryOpFlags opFlags);	
-	BfTypedValue PerformAssignment_CheckOp(BfAssignmentExpression* assignExpr, bool deferBinop, BfTypedValue& leftValue, BfTypedValue& rightValue, bool& evaluatedRight);	
-	void PerformAssignment(BfAssignmentExpression* assignExpr, bool evaluatedLeft, BfTypedValue rightValue, BfTypedValue* outCascadeValue = NULL);	
+	void PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr, BfUnaryOp unaryOp, BfTokenNode* opToken, BfUnaryOpFlags opFlags);
+	BfTypedValue PerformAssignment_CheckOp(BfAssignmentExpression* assignExpr, bool deferBinop, BfTypedValue& leftValue, BfTypedValue& rightValue, bool& evaluatedRight);
+	void PerformAssignment(BfAssignmentExpression* assignExpr, bool evaluatedLeft, BfTypedValue rightValue, BfTypedValue* outCascadeValue = NULL);
 	void PopulateDeferrredTupleAssignData(BfTupleExpression* tupleExr, DeferredTupleAssignData& deferredTupleAssignData);
 	void AssignDeferrredTupleAssignData(BfAssignmentExpression* assignExpr, DeferredTupleAssignData& deferredTupleAssignData, BfTypedValue rightValue);
-	void DoTupleAssignment(BfAssignmentExpression* assignExpr);	
-	void FinishDeferredEvals(SizedArrayImpl<BfResolvedArg>& argValues);	
+	void DoTupleAssignment(BfAssignmentExpression* assignExpr);
+	void FinishDeferredEvals(SizedArrayImpl<BfResolvedArg>& argValues);
 	void FinishDeferredEvals(BfResolvedArgs& argValues);
 	bool LookupTypeProp(BfTypeOfExpression* typeOfExpr, BfIdentifierNode* propName);
 	void DoTypeIntAttr(BfTypeReference* typeRef, BfTokenNode* commaToken, BfIdentifierNode* memberName, BfToken token);
@@ -534,7 +533,7 @@ public:
 	void CreateObject(BfObjectCreateExpression* objCreateExpr, BfAstNode* allocNode, BfType* allocType);
 
 	//////////////////////////////////////////////////////////////////////////
-	
+
 	virtual void Visit(BfErrorNode* errorNode) override;
 	virtual void Visit(BfTypeReference* typeRef) override;
 	virtual void Visit(BfAttributedExpression* attribExpr) override;
@@ -543,7 +542,7 @@ public:
 	virtual void Visit(BfVariableDeclaration* varDecl) override;
 	virtual void Visit(BfCaseExpression* caseExpr) override;
 	virtual void Visit(BfTypedValueExpression* typedValueExpr) override;
-	virtual void Visit(BfLiteralExpression* literalExpr) override;	
+	virtual void Visit(BfLiteralExpression* literalExpr) override;
 	virtual void Visit(BfStringInterpolationExpression* stringInterpolationExpression) override;
 	virtual void Visit(BfIdentifierNode* identifierNode) override;
 	virtual void Visit(BfAttributedIdentifierNode* attrIdentifierNode) override;
@@ -553,7 +552,7 @@ public:
 	virtual void Visit(BfMixinExpression* mixinExpr) override;
 	virtual void Visit(BfSizedArrayCreateExpression* createExpr) override;
 	virtual void Visit(BfInitializerExpression* initExpr) override;
-	virtual void Visit(BfCollectionInitializerExpression* initExpr) override;	
+	virtual void Visit(BfCollectionInitializerExpression* initExpr) override;
 	virtual void Visit(BfTypeOfExpression* typeOfExpr) override;
 	virtual void Visit(BfSizeOfExpression* sizeOfExpr) override;
 	virtual void Visit(BfAlignOfExpression* alignOfExpr) override;
@@ -570,7 +569,7 @@ public:
 	virtual void Visit(BfLambdaBindExpression* lambdaBindExpr) override;
 	virtual void Visit(BfObjectCreateExpression* objCreateExpr) override;
 	virtual void Visit(BfBoxExpression* boxExpr) override;
-	virtual void Visit(BfInvocationExpression* invocationExpr) override;	
+	virtual void Visit(BfInvocationExpression* invocationExpr) override;
 	virtual void Visit(BfConditionalExpression* condExpr) override;
 	virtual void Visit(BfAssignmentExpression* assignExpr) override;
 	virtual void Visit(BfParenthesizedExpression* parenExpr) override;
@@ -578,7 +577,7 @@ public:
 	virtual void Visit(BfMemberReferenceExpression* memberRefExpr) override;
 	virtual void Visit(BfIndexerExpression* indexerExpr) override;
 	virtual void Visit(BfUnaryOperatorExpression* unaryOpExpr) override;
-	virtual void Visit(BfBinaryOperatorExpression* binOpExpr) override; 	
+	virtual void Visit(BfBinaryOperatorExpression* binOpExpr) override;
 };
 
 NS_BF_END

+ 5 - 5
IDEHelper/Compiler/BfFixits.h

@@ -19,7 +19,7 @@ public:
 			{
 				idx++;
 				break;
-			}			
+			}
 			idx++;
 		}
 		return idx;
@@ -37,10 +37,10 @@ public:
 		{
 			char c = source->mSrc[idx];
 			if (c == '\n')
-			{		
+			{
 				idx++;
 				break;
-			}			
+			}
 			idx--;
 		}
 		return idx;
@@ -67,13 +67,13 @@ public:
 
 	virtual void Visit(BfUsingDirective* usingDirective) override
 	{
-		mLastIdx = FindLineStartAfter(usingDirective->GetSourceData(), usingDirective->GetSrcEnd());		
+		mLastIdx = FindLineStartAfter(usingDirective->GetSourceData(), usingDirective->GetSrcEnd());
 	}
 
 	virtual void Visit(BfNamespaceDeclaration* namespaceDecl) override
 	{
 		if (mFromIdx != -1)
-		{ 
+		{
 			if ((mFromIdx < namespaceDecl->mSrcStart) || (mFromIdx >= namespaceDecl->mSrcEnd))
 			{
 				// Not inside

File diff ditekan karena terlalu besar
+ 136 - 137
IDEHelper/Compiler/BfIRBuilder.cpp


+ 138 - 139
IDEHelper/Compiler/BfIRBuilder.h

@@ -60,16 +60,16 @@ public:
 		mCurSrcPos = 0;
 		mCurLine = 0;
 		mCurColumn = 0;
-	}	
+	}
 };
 
 enum BfTypeCode : uint8
-{	
+{
 	BfTypeCode_None,
 	BfTypeCode_CharPtr,
 	BfTypeCode_StringId,
 	BfTypeCode_Pointer,
-	BfTypeCode_NullPtr,	
+	BfTypeCode_NullPtr,
 	BfTypeCode_Self,
 	BfTypeCode_Dot,
 	BfTypeCode_Var,
@@ -123,7 +123,7 @@ enum BfTypeCode : uint8
 
 enum BfConstType
 {
-	BfConstType_GlobalVar = BfTypeCode_Length,	
+	BfConstType_GlobalVar = BfTypeCode_Length,
 	BfConstType_BitCast,
 	BfConstType_BitCastNull,
 	BfConstType_GEP32_1,
@@ -145,13 +145,13 @@ enum BfConstType
 
 enum BfIRValueFlags : uint8
 {
-	BfIRValueFlags_None,	
+	BfIRValueFlags_None,
 	BfIRValueFlags_Value = 1,
 	BfIRValueFlags_Arg = 2,
 	BfIRValueFlags_Const = 4,
 	BfIRValueFlags_FromLLVM = 8,
 	BfIRValueFlags_Block = 16,
-	BfIRValueFlags_Func = 32	
+	BfIRValueFlags_Func = 32
 };
 
 enum BfIRCmd : uint8
@@ -162,7 +162,7 @@ enum BfIRCmd : uint8
 	BfIRCmd_WriteIR,
 
 	BfIRCmd_SetType,
-	BfIRCmd_SetInstType,	
+	BfIRCmd_SetInstType,
 	BfIRCmd_PrimitiveType,
 	BfIRCmd_CreateAnonymousStruct,
 	BfIRCmd_CreateStruct,
@@ -175,7 +175,7 @@ enum BfIRCmd : uint8
 	BfIRCmd_GetPointerToType,
 	BfIRCmd_GetSizedArrayType,
 	BfIRCmd_GetVectorType,
-	
+
 	BfIRCmd_CreateConstStructZero,
 	BfIRCmd_CreateConstAgg,
 	BfIRCmd_CreateConstArrayZero,
@@ -228,10 +228,10 @@ enum BfIRCmd : uint8
 	BfIRCmd_SetAllocaNoChkStkHint,
 	BfIRCmd_SetAllocaForceMem,
 	BfIRCmd_AliasValue,
-	BfIRCmd_LifetimeStart,	
+	BfIRCmd_LifetimeStart,
 	BfIRCmd_LifetimeEnd,
 	BfIRCmd_LifetimeSoftEnd,
-	BfIRCmd_LifetimeExtend,	
+	BfIRCmd_LifetimeExtend,
 	BfIRCmd_ValueScopeStart,
 	BfIRCmd_ValueScopeRetain,
 	BfIRCmd_ValueScopeSoftEnd,
@@ -255,9 +255,9 @@ enum BfIRCmd : uint8
 
 	BfIRCmd_CreateBlock,
 	BfIRCmd_MaybeChainNewBlock,
-	BfIRCmd_AddBlock,	
+	BfIRCmd_AddBlock,
 	BfIRCmd_DropBlocks,
-	BfIRCmd_MergeBlockDown,	
+	BfIRCmd_MergeBlockDown,
 	BfIRCmd_GetInsertBlock,
 	BfIRCmd_SetInsertPoint,
 	BfIRCmd_SetInsertPointAtStart,
@@ -276,9 +276,9 @@ enum BfIRCmd : uint8
 	BfIRCmd_CreatePhi,
 	BfIRCmd_AddPhiIncoming,
 
-	BfIRCmd_GetIntrinsic,	
-	BfIRCmd_CreateFunctionType,	
-	BfIRCmd_CreateFunction,	
+	BfIRCmd_GetIntrinsic,
+	BfIRCmd_CreateFunctionType,
+	BfIRCmd_CreateFunction,
 	BfIRCmd_SetFunctionName,
 	BfIRCmd_EnsureFunctionPatchable,
 	BfIRCmd_RemapBindFunction,
@@ -293,10 +293,10 @@ enum BfIRCmd : uint8
 	BfIRCmd_CreateRetVoid,
 	BfIRCmd_CreateUnreachable,
 	BfIRCmd_Call_AddAttribute,
-	BfIRCmd_Call_AddAttribute1,	
+	BfIRCmd_Call_AddAttribute1,
 	BfIRCmd_Func_AddAttribute,
 	BfIRCmd_Func_AddAttribute1,
-	BfIRCmd_Func_SetParamName,	
+	BfIRCmd_Func_SetParamName,
 	BfIRCmd_Func_DeleteBody,
 	BfIRCmd_Func_SafeRename,
 	BfIRCmd_Func_SafeRenameFrom,
@@ -385,7 +385,7 @@ enum BfIRParamType : uint8
 	BfIRParamType_Arg,
 	BfIRParamType_StreamId_Abs8,
 	BfIRParamType_StreamId_Rel,
-	BfIRParamType_StreamId_Back1,	
+	BfIRParamType_StreamId_Back1,
 	BfIRParamType_StreamId_Back_LAST = 0xFF, // Use remaining encoding
 };
 
@@ -425,9 +425,9 @@ enum BfIRIntrinsic : uint8
 	BfIRIntrinsic_AtomicAnd,
 	BfIRIntrinsic_AtomicCmpStore,
 	BfIRIntrinsic_AtomicCmpStore_Weak,
-	BfIRIntrinsic_AtomicCmpXChg,	
+	BfIRIntrinsic_AtomicCmpXChg,
 	BfIRIntrinsic_AtomicFence,
-	BfIRIntrinsic_AtomicLoad,		
+	BfIRIntrinsic_AtomicLoad,
 	BfIRIntrinsic_AtomicMax,
 	BfIRIntrinsic_AtomicMin,
 	BfIRIntrinsic_AtomicNAnd,
@@ -440,14 +440,14 @@ enum BfIRIntrinsic : uint8
 	BfIRIntrinsic_AtomicXor,
 	BfIRIntrinsic_BSwap,
 	BfIRIntrinsic_Cast,
-	BfIRIntrinsic_Cos,	
+	BfIRIntrinsic_Cos,
 	BfIRIntrinsic_DebugTrap,
 	BfIRIntrinsic_Div,
 	BfIRIntrinsic_Eq,
 	BfIRIntrinsic_Floor,
-	BfIRIntrinsic_Free,	
+	BfIRIntrinsic_Free,
 	BfIRIntrinsic_Gt,
-	BfIRIntrinsic_GtE,	
+	BfIRIntrinsic_GtE,
 	BfIRIntrinsic_Index,
 	BfIRIntrinsic_Log,
 	BfIRIntrinsic_Log10,
@@ -459,7 +459,7 @@ enum BfIRIntrinsic : uint8
 	BfIRIntrinsic_MemMove,
 	BfIRIntrinsic_MemSet,
 	BfIRIntrinsic_Mod,
-	BfIRIntrinsic_Mul,	
+	BfIRIntrinsic_Mul,
 	BfIRIntrinsic_Neq,
 	BfIRIntrinsic_Not,
 	BfIRIntrinsic_Or,
@@ -472,8 +472,8 @@ enum BfIRIntrinsic : uint8
 	BfIRIntrinsic_SHR,
 	BfIRIntrinsic_Shuffle,
 	BfIRIntrinsic_Sin,
-	BfIRIntrinsic_Sqrt,	
-	BfIRIntrinsic_Sub,	
+	BfIRIntrinsic_Sqrt,
+	BfIRIntrinsic_Sub,
 	BfIRIntrinsic_VAArg,
 	BfIRIntrinsic_VAEnd,
 	BfIRIntrinsic_VAStart,
@@ -537,7 +537,7 @@ public:
 		ID_IMPLICIT = -3
 	};
 
-public:	
+public:
 	int mId;
 	BfIRValueFlags mFlags;
 	static BfIRValue sValueless;
@@ -548,7 +548,7 @@ public:
 
 public:
 	BfIRValue()
-	{		
+	{
 		mId = -1;
 		mFlags = BfIRValueFlags_None;
 #ifdef CHECK_CONSTHOLDER
@@ -557,7 +557,7 @@ public:
 	}
 
 	BfIRValue(const BfIRValue& from)
-	{		
+	{
 		mFlags = from.mFlags;
 		mId = from.mId;
 #ifdef CHECK_CONSTHOLDER
@@ -566,23 +566,23 @@ public:
 	}
 
 	BfIRValue(BfIRValueFlags flags, int id)
-	{		
+	{
 		mFlags = flags;
-		mId = id;	
+		mId = id;
 	}
-		
+
 	operator bool() const
-	{		
+	{
 		return mFlags != BfIRValueFlags_None;
-	}	
-	
+	}
+
 	bool IsFake() const;
 	bool IsConst() const;
-	bool IsArg() const;	
+	bool IsArg() const;
 	bool IsFromLLVM() const;
 
 	bool operator==(const BfIRValue& rhs) const
-	{		
+	{
 		if (mFlags != rhs.mFlags)
 			return false;
 		if (mId != rhs.mId)
@@ -591,7 +591,7 @@ public:
 	}
 
 	bool operator!=(const BfIRValue& rhs) const
-	{	
+	{
 		if (mFlags != rhs.mFlags)
 			return true;
 		if (mId != rhs.mId)
@@ -608,7 +608,7 @@ struct BfIRTypeData
 		TypeKind_TypeId,
 		TypeKind_TypeCode,
 		TypeKind_TypeInstId,
-		TypeKind_TypeInstPtrId,		
+		TypeKind_TypeInstPtrId,
 		TypeKind_Stream,
 		TypeKind_SizedArray
 	};
@@ -624,12 +624,12 @@ struct BfIRTypeData
 
 struct BfIRType : public BfIRTypeData
 {
-public:	
+public:
 	BfIRType()
 	{
 		mKind = TypeKind_None;
 		mId = -1;
-	}	
+	}
 
 	BfIRType(BfIRTypeData typeData)
 	{
@@ -637,17 +637,17 @@ public:
 		mId = typeData.mId;
 	}
 
-	BfIRType(const BfIRValue& val) { mKind = TypeKind_Stream; mId = val.mId; }		
+	BfIRType(const BfIRValue& val) { mKind = TypeKind_Stream; mId = val.mId; }
 };
 
 struct BfIRBlock : public BfIRValue
 {
-public:	
+public:
 	BfIRBlock();
-	BfIRBlock(const BfIRValue& fromVal) : BfIRValue(fromVal) {}		
+	BfIRBlock(const BfIRValue& fromVal) : BfIRValue(fromVal) {}
 };
 
-enum BfIRAttribute 
+enum BfIRAttribute
 {
 	BfIRAttribute_NoReturn,
 	BfIRAttribute_NoAlias,
@@ -670,83 +670,83 @@ enum BfIRAttribute
 
 struct BfIRFunctionType
 {
-public:	
-	int mId;	
+public:
+	int mId;
 
-public:	
+public:
 	BfIRFunctionType();
-	BfIRFunctionType(const BfIRValue& val) { mId = val.mId; }	
+	BfIRFunctionType(const BfIRValue& val) { mId = val.mId; }
 	operator bool() const
 	{
 		return mId != -1;
-	}	
+	}
 };
 
 struct BfIRFunction : public BfIRRawValue
 {
-public:	
+public:
 	BfIRFunction();
 	BfIRFunction(const BfIRValue& val)
 	{
 		BF_ASSERT((val.mFlags == BfIRValueFlags_None) || (val.mFlags == BfIRValueFlags_Value));
 		mId = val.mId;
-	}		
+	}
 		//: BfIRValue(val) {}
-	
+
 	bool operator==(const BfIRFunction& rhs) const
-	{		
+	{
 		if (mId != rhs.mId)
 			return false;
 		return true;
 	}
 
 	bool operator!=(const BfIRFunction& rhs) const
-	{		
+	{
 		if (mId == rhs.mId)
 			return false;
 		return true;
 	}
 
 	operator bool() const
-	{		
+	{
 		return mId != -1;
 	}
 
 	operator BfIRValue() const
-	{		
+	{
 		return BfIRValue((mId == -1) ? BfIRValueFlags_None : BfIRValueFlags_Value, mId);
 	}
 };
 
 struct BfIRMDNode
 {
-public:	
+public:
 	int mId;
 
 	BfIRMDNode()
-	{	
+	{
 		mId = -1;
 	}
 
 	BfIRMDNode(const BfIRValue& val)
-	{		
+	{
 		mId = val.mId;
 	}
-	
+
 	operator bool() const
-	{		
+	{
 		return mId != -1;
-	}	
+	}
 
 	bool operator==(const BfIRMDNode& rhs) const
-	{		
+	{
 		if (mId != rhs.mId)
 			return false;
 		return true;
 	}
 
 	bool operator!=(const BfIRMDNode& rhs) const
-	{		
+	{
 		if (mId == rhs.mId)
 			return false;
 		return true;
@@ -763,7 +763,7 @@ public:
 public:
 	BfFileInstance()
 	{
-		mParser = NULL;		
+		mParser = NULL;
 	}
 };
 
@@ -776,7 +776,7 @@ struct BfGlobalVar
 	BfIRLinkageType mLinkageType;
 	int mStreamId;
 	BfIRValue mInitializer;
-	bool mIsTLS;	
+	bool mIsTLS;
 	int mAlignment;
 };
 
@@ -789,7 +789,7 @@ struct BfGlobalVar_TypeInst
 	BfIRLinkageType mLinkageType;
 	int mStreamId;
 	BfIRValue mInitializer;
-	bool mIsTLS;	
+	bool mIsTLS;
 };
 
 struct BfTypeOf_Const
@@ -813,7 +813,7 @@ public:
 	{
 		BfTypeCode mTypeCode;
 		BfConstType mConstType;
-	};	
+	};
 	union
 	{
 		bool mBool;
@@ -886,7 +886,7 @@ struct BfConstantGEP32_1
 {
 	BfConstType mConstType;
 	int mTarget;
-	int mIdx0;	
+	int mIdx0;
 };
 
 struct BfConstantGEP32_2
@@ -901,7 +901,7 @@ struct BfConstantExtractValue
 {
 	BfConstType mConstType;
 	int mTarget;
-	int mIdx0;	
+	int mIdx0;
 };
 
 struct BfConstantAgg
@@ -931,15 +931,15 @@ public:
 	BumpAllocatorT<256> mTempAlloc;
 	BfModule* mModule;
 	Dictionary<String, BfIRValue> mGlobalVarMap;
-	
+
 public:
 	void FixTypeCode(BfTypeCode& typeCode);
 	int GetSize(BfTypeCode typeCode);
 	static int GetSize(BfTypeCode typeCode, int ptrSize);
-	static bool IsInt(BfTypeCode typeCode);	
+	static bool IsInt(BfTypeCode typeCode);
 	static bool IsChar(BfTypeCode typeCode);
 	static bool IsIntable(BfTypeCode typeCode);
-	static bool IsSigned(BfTypeCode typeCode);	
+	static bool IsSigned(BfTypeCode typeCode);
 	static bool IsFloat(BfTypeCode typeCode);
 	const char* AllocStr(const StringImpl& str);
 
@@ -951,7 +951,7 @@ public:
 	String ToString(BfIRType irType);
 	void pv(const BfIRValue& irValue);
 
-	BfConstant* GetConstantById(int id);	
+	BfConstant* GetConstantById(int id);
 	BfConstant* GetConstant(BfIRValue id);
 	bool TryGetBool(BfIRValue id, bool& boolVal);
 	int IsZero(BfIRValue val);
@@ -961,7 +961,7 @@ public:
 
 	BfIRType GetSizedArrayType(BfIRType elementType, int length);
 
-	BfIRValue CreateConst(BfTypeCode typeCode, uint64 val);	
+	BfIRValue CreateConst(BfTypeCode typeCode, uint64 val);
 	BfIRValue CreateConst(BfTypeCode typeCode, int val);
 	BfIRValue CreateConst(BfTypeCode typeCode, double val);
 	BfIRValue CreateConst(BfConstant* fromConst, BfIRConstHolder* fromHolder);
@@ -976,11 +976,11 @@ public:
 	BfIRValue CreateConstBox(BfIRValue val, BfIRType type);
 	BfIRValue CreateTypeOf(BfType* type);
 	BfIRValue CreateTypeOf(BfType* type, BfIRValue typeData);
-	BfIRValue GetUndefConstValue(BfIRType type);	
+	BfIRValue GetUndefConstValue(BfIRType type);
 	BfIRValue CreateGlobalVariableConstant(BfIRType varType, bool isConstant, BfIRLinkageType linkageType, BfIRValue initializer, const StringImpl& name, bool isTLS = false);
 
 	bool WriteConstant(BfIRValue val, void* ptr, BfType* type);
-	BfIRValue ReadConstant(void* ptr, BfType* type);	
+	BfIRValue ReadConstant(void* ptr, BfType* type);
 };
 
 enum BfIRPopulateType
@@ -1011,16 +1011,16 @@ enum BfOverflowCheckKind : int8
 
 class BfIRBuilder : public BfIRConstHolder
 {
-public:	
+public:
 	bool mIgnoreWrites;
 	bool mDbgVerifyCodeGen;
 	int mCurFakeId;
 	bool mHasGlobalDefs;
 	bool mIsBeefBackend;
-	int mNumFunctionsWithBodies;	
+	int mNumFunctionsWithBodies;
 	int mBlockCount;
-	bool mHasStarted;		
-	int mCmdCount;	
+	bool mHasStarted;
+	int mCmdCount;
 
 	ChunkedDataBuffer mStream;
 	BfIRBlock mActualInsertBlock; // Only when not ignoring writes
@@ -1032,12 +1032,12 @@ public:
 	Dictionary<StringView, BfIRFunction> mFunctionMap;
 	Dictionary<BfType*, BfIRPopulateType> mTypeMap;
 	Dictionary<int, BfIRValue> mConstMemMap;
-	Array<BfTypeInstance*> mDITemporaryTypes;	
+	Array<BfTypeInstance*> mDITemporaryTypes;
 	BfIRFunction mActiveFunction;
 	bool mActiveFunctionHasBody;
 	Array<BfFilePosition> mSavedDebugLocs;
 	Array<BfType*> mDeferredDbgTypeDefs;
-		
+
 	BfIRCodeGenBase* mIRCodeGen;
 	BfIRCodeGen* mBfIRCodeGen;
 	BeIRCodeGen* mBeIRCodeGen;
@@ -1050,7 +1050,7 @@ public:
 
 public:
 	~BfIRBuilder();
-	
+
 	void WriteSLEB128(int64 val);
 	void WriteSLEB128(int32 val);
 	void Write(uint8 val);
@@ -1061,24 +1061,24 @@ public:
 	void Write(const StringImpl& str);
 	void Write(const BfIRValue& irValue);
 	void Write(BfTypeCode typeCode);
-	void Write(const BfIRTypeData& type);	
+	void Write(const BfIRTypeData& type);
 	void Write(BfIRFunctionType func);
 	void Write(BfIRFunction funcType);
 	void Write(BfIRBlock block);
-	void Write(BfIRMDNode node);	
+	void Write(BfIRMDNode node);
 	template <typename T>
 	void Write(const BfSizedArray<T>& sizedArray)
 	{
-		WriteSLEB128(sizedArray.mSize);		
+		WriteSLEB128(sizedArray.mSize);
 		for (int i = 0; i < sizedArray.mSize; i++)
 			Write(sizedArray.mVals[i]);
-	}	
-	BfIRValue WriteCmd(BfIRCmd cmd);	
+	}
+	BfIRValue WriteCmd(BfIRCmd cmd);
 
 	template <typename T>
 	void WriteArg(const T& first)
 	{
-		Write(first);		
+		Write(first);
 	}
 
 	template <typename T, typename... Args>
@@ -1090,17 +1090,17 @@ public:
 
 	template <typename... Args>
 	BfIRValue WriteCmd(BfIRCmd cmd, const Args&... args)
-	{			
+	{
 		if (mIgnoreWrites)
 			return GetFakeVal();
 		//int dataPos = mStream.GetSize();
-		auto result = WriteCmd(cmd);		
-		WriteArg(args...);		
+		auto result = WriteCmd(cmd);
+		WriteArg(args...);
 		return result;
 		//return BfIRValue(BfIRValueFlags_Value, dataPos);
 	}
 
-public:	
+public:
 	void NewCmdInserted();
 	BfIRMDNode CreateNamespaceScope(BfType* type, BfIRMDNode fileDIScope);
 	String GetDebugTypeName(BfTypeInstance* typeInstance, bool includeOuterTypeName);
@@ -1114,18 +1114,18 @@ public:
 	BfIRPopulateType GetPopulateTypeState(BfType* type);
 	void PopulateType(BfType* type, BfIRPopulateType populateType = BfIRPopulateType_Full);
 	void SetType(BfType* type, BfIRType irType);
-	void SetInstType(BfType* type, BfIRType irType);	
+	void SetInstType(BfType* type, BfIRType irType);
 	int GetFakeId();
 	BfIRValue GetFakeVal();
 	BfIRValue GetFakeConst();
-	BfIRType GetFakeType();	
-	BfIRType GetFakeBlock();	
-	BfIRFunctionType GetFakeFunctionType();	
-	BfIRFunction GetFakeFunction();	
+	BfIRType GetFakeType();
+	BfIRType GetFakeBlock();
+	BfIRFunctionType GetFakeFunctionType();
+	BfIRFunction GetFakeFunction();
 
 public:
 	void OpFailed();
-	
+
 	uint8 CheckedAdd(uint8 a, uint8 b);
 	uint16 CheckedAdd(uint16 a, uint16 b);
 	uint32 CheckedAdd(uint32 a, uint32 b);
@@ -1169,7 +1169,7 @@ public:
 	int64 CheckedShl(int64 a, int64 b);
 
 public:
-	BfIRBuilder(BfModule* module);		
+	BfIRBuilder(BfModule* module);
 	bool HasExports(); // Contains non-empty functions and/or non-empty globals
 
 	String ToString(BfIRValue irValue);
@@ -1183,9 +1183,9 @@ public:
 	void pt(const BfIRType& irType);
 	void pbft(BfType* type);
 	void pt(const BfIRFunction& irFun);
-	void pft(const BfIRFunctionType& irType);	
+	void pft(const BfIRFunctionType& irType);
 	void pmd(const BfIRMDNode& irMDNode);
-			
+
 	void GetBufferData(Array<uint8>& outBuffer);
 	void ClearConstData();
 	void ClearNonConstData();
@@ -1194,11 +1194,11 @@ public:
 	void SetBackend(bool isBeefBackend);
 	void RemoveIRCodeGen();
 	void WriteIR(const StringImpl& fileName);
-	
+
 	void Module_SetTargetTriple(const StringImpl& targetTriple, const StringImpl& targetCPU);
 	void Module_AddModuleFlag(const StringImpl& flag, int val);
 
-	BfIRType GetPrimitiveType(BfTypeCode typeCode);	
+	BfIRType GetPrimitiveType(BfTypeCode typeCode);
 	BfIRType CreateStructType(const StringImpl& name);
 	BfIRType CreateStructType(const BfSizedArray<BfIRType>& memberTypes);
 	void StructSetBody(BfIRType type, const BfSizedArray<BfIRType>& memberTypes, int size, int align, bool isPacked);
@@ -1210,7 +1210,7 @@ public:
 	BfIRType GetPointerTo(BfIRType type);
 	BfIRType GetSizedArrayType(BfIRType elementType, int length);
 	BfIRType GetVectorType(BfIRType elementType, int length);
-	
+
 	BfIRValue CreateConstAgg_Value(BfIRType type, const BfSizedArray<BfIRValue>& values);
 	BfIRValue CreateConstString(const StringImpl& string);
 	BfIRValue ConstToMemory(BfIRValue constVal);
@@ -1252,13 +1252,13 @@ public:
 	BfIRValue CreateExtractValue(BfIRValue val, int idx);
 	BfIRValue CreateExtractValue(BfIRValue val, BfIRValue idx);
 	BfIRValue CreateInsertValue(BfIRValue agg, BfIRValue val, int idx);
-	
+
 	BfIRValue CreateAlloca(BfIRType type);
 	BfIRValue CreateAlloca(BfIRType type, BfIRValue arraySize);
 	void SetAllocaAlignment(BfIRValue val, int alignment);
 	// When we do a dynamic alloca where we know the memory access patterns will not cause a page fault, we can omit the __chkstk call
 	//  Generally, this is when we allocate less than 4k and we know there will be a write on this memory before the next alloca
-	void SetAllocaNoChkStkHint(BfIRValue val);	
+	void SetAllocaNoChkStkHint(BfIRValue val);
 	void SetAllocaForceMem(BfIRValue val);
 	BfIRValue CreateAliasValue(BfIRValue val);
 	BfIRValue CreateLifetimeStart(BfIRValue val);
@@ -1277,8 +1277,8 @@ public:
 	void CreateFence(BfIRFenceType fenceType);
 	BfIRValue CreateStackSave();
 	BfIRValue CreateStackRestore(BfIRValue stackVal);
-	
-	BfIRValue CreateGlobalVariable(BfIRType varType, bool isConstant, BfIRLinkageType linkageType, BfIRValue initializer, const StringImpl& name, bool isTLS = false);	
+
+	BfIRValue CreateGlobalVariable(BfIRType varType, bool isConstant, BfIRLinkageType linkageType, BfIRValue initializer, const StringImpl& name, bool isTLS = false);
 	void CreateGlobalVariable(BfIRValue irValue);
 	void GlobalVar_SetUnnamedAddr(BfIRValue val, bool unnamedAddr);
 	void GlobalVar_SetInitializer(BfIRValue globalVar, BfIRValue initVal);
@@ -1289,32 +1289,32 @@ public:
 
 	BfIRBlock CreateBlock(const StringImpl& name, bool addNow = false);
 	BfIRBlock MaybeChainNewBlock(const StringImpl& name); // Creates new block if current block isn't empty
-	void AddBlock(BfIRBlock block);	
+	void AddBlock(BfIRBlock block);
 	void DropBlocks(BfIRBlock block);
-	void MergeBlockDown(BfIRBlock fromBlock, BfIRBlock intoBlock);	
+	void MergeBlockDown(BfIRBlock fromBlock, BfIRBlock intoBlock);
 	void SetInsertPoint(BfIRValue value);
 	void SetInsertPoint(BfIRBlock block);
 	void SetInsertPointAtStart(BfIRBlock block);
-	void EraseFromParent(BfIRBlock block);	
+	void EraseFromParent(BfIRBlock block);
 	void DeleteBlock(BfIRBlock block);
 	void EraseInstFromParent(BfIRValue val);
 	BfIRValue CreateBr(BfIRBlock block);
 	BfIRValue CreateBr_Fake(BfIRBlock block);
 	BfIRValue CreateBr_NoCollapse(BfIRBlock block);
 	void CreateCondBr(BfIRValue val, BfIRBlock trueBlock, BfIRBlock falseBlock);
-	BfIRBlock GetInsertBlock();	
-	void MoveBlockToEnd(BfIRBlock block);	
+	BfIRBlock GetInsertBlock();
+	void MoveBlockToEnd(BfIRBlock block);
 
 	BfIRValue CreateSwitch(BfIRValue value, BfIRBlock dest, int numCases);
 	BfIRValue AddSwitchCase(BfIRValue switchVal, BfIRValue caseVal, BfIRBlock caseBlock);
 	void SetSwitchDefaultDest(BfIRValue switchVal, BfIRBlock caseBlock);
 	BfIRValue CreatePhi(BfIRType type, int incomingCount);
 	void AddPhiIncoming(BfIRValue phi, BfIRValue value, BfIRBlock comingFrom);
-	
-	BfIRFunction GetIntrinsic(String intrinName, int intrinId, BfIRType returnType, const BfSizedArray<BfIRType>& paramTypes);	
+
+	BfIRFunction GetIntrinsic(String intrinName, int intrinId, BfIRType returnType, const BfSizedArray<BfIRType>& paramTypes);
 	BfIRFunctionType MapMethod(BfMethodInstance* methodInstance);
 	BfIRFunctionType CreateFunctionType(BfIRType resultType, const BfSizedArray<BfIRType>& paramTypes, bool isVarArg = false);
-	BfIRFunction CreateFunction(BfIRFunctionType funcType, BfIRLinkageType linkageType, const StringImpl& name);	
+	BfIRFunction CreateFunction(BfIRFunctionType funcType, BfIRLinkageType linkageType, const StringImpl& name);
 	void SetFunctionName(BfIRValue func, const StringImpl& name);
 	void EnsureFunctionPatchable();
 	BfIRValue RemapBindFunction(BfIRValue func);
@@ -1328,18 +1328,18 @@ public:
 	void SetCallAttribute(BfIRValue callInst, int paramIdx, BfIRAttribute attribute);
 	BfIRValue CreateRet(BfIRValue val);
 	BfIRValue CreateSetRet(BfIRValue val, int returnTypeId);
-	void CreateRetVoid();	
+	void CreateRetVoid();
 	void CreateUnreachable();
 	void Call_AddAttribute(BfIRValue callInst, int argIdx, BfIRAttribute attr);
-	void Call_AddAttribute(BfIRValue callInst, int argIdx, BfIRAttribute attr, int arg);	
+	void Call_AddAttribute(BfIRValue callInst, int argIdx, BfIRAttribute attr, int arg);
 	void Func_AddAttribute(BfIRFunction func, int argIdx, BfIRAttribute attr);
 	void Func_AddAttribute(BfIRFunction func, int argIdx, BfIRAttribute attr, int arg);
-	void Func_SetParamName(BfIRFunction func, int argIdx, const StringImpl& name);	
+	void Func_SetParamName(BfIRFunction func, int argIdx, const StringImpl& name);
 	void Func_DeleteBody(BfIRFunction func);
 	void Func_SafeRename(BfIRFunction func);
 	void Func_SafeRenameFrom(BfIRFunction func, const StringImpl& prevName);
 	void Func_SetLinkage(BfIRFunction func, BfIRLinkageType linkage);
-	
+
 	void Comptime_Error(int errorKind);
 	BfIRValue Comptime_GetBfType(int typeId, BfIRType resultType);
 	BfIRValue Comptime_GetReflectType(int typeId, BfIRType resultType);
@@ -1351,7 +1351,7 @@ public:
 	void RestoreDebugLocation();
 	void DupDebugLocation();
 	bool HasDebugLocation();
-	void ClearDebugLocation();	
+	void ClearDebugLocation();
 	void ClearDebugLocation(BfIRValue inst);
 	void ClearDebugLocation_Last();
 	void UpdateDebugLocation(BfIRValue inst);
@@ -1360,29 +1360,29 @@ public:
 	void CreateEnsureInstructionAt();
 	void CreateStatementStart();
 	void CreateObjectAccessCheck(BfIRValue value, bool useAsm);
-	
+
 	void DbgInit();
-	void DbgFinalize();	
+	void DbgFinalize();
 	bool DbgHasInfo();
 	bool DbgHasLineInfo();
 	String DbgGetStaticFieldName(BfFieldInstance* fieldInstance);
 	void DbgAddPrefix(String& name);
-	BfIRMDNode DbgCreateCompileUnit(int lang, const StringImpl& filename, const StringImpl& directory, const StringImpl& producer, bool isOptimized, 
-		const StringImpl& flags, int runtimeVer, bool linesOnly);	
+	BfIRMDNode DbgCreateCompileUnit(int lang, const StringImpl& filename, const StringImpl& directory, const StringImpl& producer, bool isOptimized,
+		const StringImpl& flags, int runtimeVer, bool linesOnly);
 	BfIRMDNode DbgCreateFile(const StringImpl& fileName, const StringImpl& directory, const Val128& md5Hash);
 	BfIRMDNode DbgGetCurrentLocation();
 	void DbgSetType(BfType * type, BfIRMDNode diType);
-	void DbgSetInstType(BfType * type, BfIRMDNode diType);	
+	void DbgSetInstType(BfType * type, BfIRMDNode diType);
 	BfIRMDNode DbgCreateConstValue(int64 val);
-	BfIRMDNode DbgGetType(BfType* type, BfIRPopulateType populateType = BfIRPopulateType_Declaration);	
+	BfIRMDNode DbgGetType(BfType* type, BfIRPopulateType populateType = BfIRPopulateType_Declaration);
 	BfIRMDNode DbgGetTypeInst(BfTypeInstance* typeInst, BfIRPopulateType populateType = BfIRPopulateType_Declaration);
 	void DbgTrackDITypes(BfType* type);
 	BfIRMDNode DbgCreateNameSpace(BfIRMDNode scope, const StringImpl& name, BfIRMDNode file, int lineNum);
 	BfIRMDNode DbgCreateImportedModule(BfIRMDNode context, BfIRMDNode namespaceNode, int line);
 	BfIRMDNode DbgCreateBasicType(const StringImpl& name, int64 sizeInBits, int64 alignInBits, int encoding);
-	BfIRMDNode DbgCreateStructType(BfIRMDNode context, const StringImpl& name, BfIRMDNode file, int lineNum, int64 sizeInBits, int64 alignInBits, 
+	BfIRMDNode DbgCreateStructType(BfIRMDNode context, const StringImpl& name, BfIRMDNode file, int lineNum, int64 sizeInBits, int64 alignInBits,
 		int flags, BfIRMDNode derivedFrom, const BfSizedArray<BfIRMDNode>& elements);
-	BfIRMDNode DbgCreateEnumerationType(BfIRMDNode scope, const StringImpl& name, BfIRMDNode file, int lineNumber, int64 SizeInBits, int64 alignInBits, 
+	BfIRMDNode DbgCreateEnumerationType(BfIRMDNode scope, const StringImpl& name, BfIRMDNode file, int lineNumber, int64 SizeInBits, int64 alignInBits,
 		const BfSizedArray<BfIRMDNode>& elements, BfIRMDNode underlyingType);
 	BfIRMDNode DbgCreatePointerType(BfIRMDNode diType);
 	BfIRMDNode DbgCreateReferenceType(BfIRMDNode diType);
@@ -1397,14 +1397,14 @@ public:
 	void DbgDeleteTemporary(BfIRMDNode diNode);
 	BfIRMDNode DbgMakePermanent(BfIRMDNode diNode, BfIRMDNode diBaseType, const BfSizedArray<BfIRMDNode>& elements);
 	BfIRMDNode DbgCreateEnumerator(const StringImpl& name, int64 val);
-	BfIRMDNode DbgCreateMemberType(BfIRMDNode scope, const StringImpl& name, BfIRMDNode file, int lineNumber, int64 sizeInBits, int64 alignInBits, 
+	BfIRMDNode DbgCreateMemberType(BfIRMDNode scope, const StringImpl& name, BfIRMDNode file, int lineNumber, int64 sizeInBits, int64 alignInBits,
 		int64 offsetInBits, int flags, BfIRMDNode type);
 	BfIRMDNode DbgCreateStaticMemberType(BfIRMDNode scope, const StringImpl& name, BfIRMDNode file, int lineNumber, BfIRMDNode type, int flags, BfIRValue val);
 	BfIRMDNode DbgCreateInheritance(BfIRMDNode type, BfIRMDNode baseType, int64 baseOffset, int flags);
 	BfIRMDNode DbgCreateMethod(BfIRMDNode context, const StringImpl& name, const StringImpl& linkageName, BfIRMDNode file, int lineNum, BfIRMDNode type,
-		bool isLocalToUnit, bool isDefinition, int vk, int vIndex, BfIRMDNode vTableHolder, int flags, bool isOptimized, BfIRValue fn, 
+		bool isLocalToUnit, bool isDefinition, int vk, int vIndex, BfIRMDNode vTableHolder, int flags, bool isOptimized, BfIRValue fn,
 		const BfSizedArray<BfIRMDNode>& genericArgs, const BfSizedArray<BfIRValue>& genericConstValueArgs);
-	BfIRMDNode DbgCreateFunction(BfIRMDNode context, const StringImpl& name, const StringImpl& linkageName, BfIRMDNode file, int lineNum, BfIRMDNode type, 
+	BfIRMDNode DbgCreateFunction(BfIRMDNode context, const StringImpl& name, const StringImpl& linkageName, BfIRMDNode file, int lineNum, BfIRMDNode type,
 		bool isLocalToUnit, bool isDefinition, int scopeLine, int flags, bool isOptimized, BfIRValue fn);
 	BfIRMDNode DbgCreateParameterVariable(BfIRMDNode scope, const StringImpl& name, int argNo, BfIRMDNode file, int lineNum, BfIRMDNode type,
 		bool AlwaysPreserve = false, int flags = 0);
@@ -1414,14 +1414,13 @@ public:
 	BfIRValue DbgInsertValueIntrinsic(BfIRValue val, BfIRMDNode varInfo);
 	BfIRValue DbgInsertDeclare(BfIRValue val, BfIRMDNode varInfo, BfIRValue declareBefore = BfIRValue());
 	BfIRValue DbgLifetimeEnd(BfIRMDNode varInfo);
-	void DbgCreateGlobalVariable(BfIRMDNode context, const StringImpl& name, const StringImpl& linkageName, BfIRMDNode file, int lineNumber, 
+	void DbgCreateGlobalVariable(BfIRMDNode context, const StringImpl& name, const StringImpl& linkageName, BfIRMDNode file, int lineNumber,
 		BfIRMDNode type, bool isLocalToUnit, BfIRValue val, BfIRMDNode Decl = BfIRMDNode());
-	BfIRMDNode DbgCreateLexicalBlock(BfIRMDNode scope, BfIRMDNode file, int line, int col);	
-	void DbgCreateAnnotation(BfIRMDNode scope, const StringImpl& name, BfIRValue value);	
+	BfIRMDNode DbgCreateLexicalBlock(BfIRMDNode scope, BfIRMDNode file, int line, int col);
+	void DbgCreateAnnotation(BfIRMDNode scope, const StringImpl& name, BfIRValue value);
 
 	BfIRState GetState();
 	void SetState(const BfIRState& state);
 };
 
 NS_BF_END
-

File diff ditekan karena terlalu besar
+ 136 - 139
IDEHelper/Compiler/BfIRCodeGen.cpp


+ 17 - 18
IDEHelper/Compiler/BfIRCodeGen.h

@@ -20,7 +20,7 @@ namespace llvm
 	class AttributeList;
 	class Module;
 	class LLVMContext;
-	class TargetMachine;	
+	class TargetMachine;
 };
 
 NS_BF_BEGIN
@@ -41,7 +41,7 @@ class BfIRIntrinsicData
 public:
 	String mName;
 	BfIRIntrinsic mIntrinsic;
-	llvm::Type* mReturnType;	
+	llvm::Type* mReturnType;
 };
 
 struct BfIRCodeGenEntry
@@ -52,7 +52,7 @@ struct BfIRCodeGenEntry
 		llvm::Value* mLLVMValue;
 		llvm::Type* mLLVMType;
 		llvm::BasicBlock* mLLVMBlock;
-		llvm::MDNode* mLLVMMetadata;	
+		llvm::MDNode* mLLVMMetadata;
 		BfIRIntrinsicData* mIntrinsicData;
 	};
 };
@@ -67,7 +67,7 @@ public:
 	llvm::DIType* mInstDIType;
 	llvm::Type* mLLVMType;
 	llvm::Type* mAlignLLVMType;
-	llvm::Type* mInstLLVMType;	
+	llvm::Type* mInstLLVMType;
 
 public:
 	BfIRTypeEntry()
@@ -87,14 +87,14 @@ enum BfIRSizeAlignKind
 {
 	BfIRSizeAlignKind_NoTransform,
 	BfIRSizeAlignKind_Original,
-	BfIRSizeAlignKind_Aligned,	
+	BfIRSizeAlignKind_Aligned,
 };
 
 class BfIRCodeGen : public BfIRCodeGenBase
 {
-public:	
-	BfIRBuilder* mBfIRBuilder;	
-	
+public:
+	BfIRBuilder* mBfIRBuilder;
+
 	BumpAllocator mAlloc;
 	BfTargetTriple mTargetTriple;
 	String mTargetCPU;
@@ -113,7 +113,7 @@ public:
 	llvm::InlineAsm* mOverflowCheckAsm;
 	llvm::DebugLoc mDebugLoc;
 	BfCodeGenOptions mCodeGenOptions;
-	bool mHasDebugLoc;	
+	bool mHasDebugLoc;
 	bool mIsCodeView;
 	bool mHadDLLExport;
 	int mConstValIdx;
@@ -122,7 +122,7 @@ public:
 	Dictionary<int, BfIRCodeGenEntry> mResults;
 	Dictionary<int, BfIRTypeEntry> mTypes;
 	Dictionary<int, llvm::Function*> mIntrinsicMap;
-	Dictionary<llvm::Function*, int> mIntrinsicReverseMap;	
+	Dictionary<llvm::Function*, int> mIntrinsicReverseMap;
 	Array<llvm::Constant*> mConfigConsts32;
 	Array<llvm::Constant*> mConfigConsts64;
 	Dictionary<llvm::Type*, llvm::Value*> mReflectDataMap;
@@ -131,7 +131,7 @@ public:
 	HashSet<llvm::BasicBlock*> mLockedBlocks;
 	OwnedArray<BfIRIntrinsicData> mIntrinsicData;
 
-public:		
+public:
 	void InitTarget();
 	void FixValues(llvm::StructType* structType, llvm::SmallVector<llvm::Value*, 8>& values);
 	void FixIndexer(llvm::Value*& val);
@@ -141,15 +141,15 @@ public:
 	BfIRTypeEntry* GetTypeEntry(llvm::Type* type);
 	void SetResult(int id, llvm::Value* value);
 	void SetResultAligned(int id, llvm::Value* value);
-	void SetResult(int id, llvm::Type* value);	
+	void SetResult(int id, llvm::Type* value);
 	void SetResult(int id, llvm::BasicBlock* value);
-	void SetResult(int id, llvm::MDNode* value);	
+	void SetResult(int id, llvm::MDNode* value);
 	void CreateMemSet(llvm::Value* addr, llvm::Value* val, llvm::Value* size, int alignment, bool isVolatile = false);
 	void AddNop();
 	llvm::Value* TryToVector(llvm::Value* value);
 	llvm::Value* TryToVector(llvm::Value* value, llvm::Type* elemType);
 	llvm::Type* GetElemType(llvm::Value* value);
-	bool TryMemCpy(llvm::Value* ptr, llvm::Value* val);	
+	bool TryMemCpy(llvm::Value* ptr, llvm::Value* val);
 	bool TryVectorCpy(llvm::Value* ptr, llvm::Value* val);
 	llvm::Type* GetSizeAlignedType(BfIRTypeEntry* typeEntry);
 	llvm::Value* GetAlignedPtr(llvm::Value* val);
@@ -168,7 +168,7 @@ public:
 	void PrintFunction();
 
 	int64 ReadSLEB128();
-	void Read(StringImpl& str);	
+	void Read(StringImpl& str);
 	void Read(int& i);
 	void Read(int64& i);
 	void Read(Val128& i);
@@ -227,14 +227,14 @@ public:
 	llvm::BasicBlock* GetLLVMBlock(int streamId);
 	llvm::MDNode* GetLLVMMetadata(int streamId);
 
-	llvm::Type* GetLLVMTypeById(int id);	
+	llvm::Type* GetLLVMTypeById(int id);
 
 	///
 
 	bool WriteObjectFile(const StringImpl& outFileName);
 	bool WriteIR(const StringImpl& outFileName, StringImpl& error);
 
-	static int GetIntrinsicId(const StringImpl& name);	
+	static int GetIntrinsicId(const StringImpl& name);
 	static const char* GetIntrinsicName(int intrinId);
 	static void SetAsmKind(BfAsmKind asmKind);
 
@@ -242,4 +242,3 @@ public:
 };
 
 NS_BF_END
-

File diff ditekan karena terlalu besar
+ 164 - 164
IDEHelper/Compiler/BfMangler.cpp


+ 15 - 15
IDEHelper/Compiler/BfMangler.h

@@ -33,7 +33,7 @@ public:
 			Kind_MethodName,
 			Kind_Prefix,
 			Kind_PrimitivePrefix,
-			Kind_GenericParam			
+			Kind_GenericParam
 		};
 
 	public:
@@ -54,7 +54,7 @@ public:
 			BfTypeInstance* mTypeInst;
 			BfMethodInstance* mMethodInstance;
 			const char* mPrefix;
-		};		
+		};
 
 	public:
 		NameSubstitute(Kind kind, void* param)
@@ -90,7 +90,7 @@ public:
 
 class BfGNUMangler : public BfMangler
 {
-public:				
+public:
 	class MangleContext
 	{
 	public:
@@ -111,22 +111,22 @@ public:
 			mPrefixObjectPointer = false;
 		}
 	};
-	
+
 	static int ParseSubIdx(StringImpl& name, int strIdx);
 	static void AddSubIdx(StringImpl& name, int strIdx);
 	static void AddSizedString(StringImpl& name, const StringImpl& addStr);
 	static BfTypeCode GetPrimTypeAt(MangleContext& mangleContext, StringImpl& name, int strIdx);
-	static void AddPrefix(MangleContext& mangleContext, StringImpl& name, int startIdx, const char* prefix);	
+	static void AddPrefix(MangleContext& mangleContext, StringImpl& name, int startIdx, const char* prefix);
 	static void FindOrCreateNameSub(MangleContext& mangleContext, StringImpl& name, const NameSubstitute& newNameSub, int& curMatchIdx, bool& matchFailed);
 	static void FindOrCreateNameSub(MangleContext& mangleContext, StringImpl& name, BfTypeInstance* typeInst, int& curMatchIdx, bool& matchFailed);
-	static void FindOrCreateNameSub(MangleContext& mangleContext, StringImpl& name, const NameSubstitute& newNameSub);	
+	static void FindOrCreateNameSub(MangleContext& mangleContext, StringImpl& name, const NameSubstitute& newNameSub);
 
 public:
 	static void MangleTypeInst(MangleContext& mangleContext, StringImpl& name, BfTypeInstance* typeInst, BfTypeInstance* postfixTypeInst = NULL, bool* isEndOpen = NULL);
 
 	static void Mangle(MangleContext& mangleContext, StringImpl& name, BfType* type, BfType* postfixType = NULL, bool isConst = false);
 	static String Mangle(BfType* type, BfModule* module = NULL);
-	static String Mangle(BfMethodInstance* methodRef);	
+	static String Mangle(BfMethodInstance* methodRef);
 	static String MangleMethodName(BfTypeInstance* type, const StringImpl& methodName);
 	static String Mangle(BfFieldInstance* methodRef);
 	static String MangleStaticFieldName(BfTypeInstance* type, const StringImpl& fieldName);
@@ -138,12 +138,12 @@ public:
 	class MangleContext
 	{
 	public:
-		bool mIsSafeMangle;		
+		bool mIsSafeMangle;
 
 		BfModule* mModule;
 		bool mCCompat;
 		bool mCPPMangle;
-		bool mIs64Bit;		
+		bool mIs64Bit;
 		SizedArray<NameSubstitute, 10> mSubstituteList;
 		SizedArray<BfType*, 10> mSubstituteTypeList;
 
@@ -154,7 +154,7 @@ public:
 	public:
 		MangleContext()
 		{
-			mIsSafeMangle = false;			
+			mIsSafeMangle = false;
 			mModule = NULL;
 			mCCompat = false;
 			mIs64Bit = false;
@@ -164,11 +164,11 @@ public:
 			mInRet = false;
 		}
 
-		BfModule* GetUnreifiedModule();		
+		BfModule* GetUnreifiedModule();
 	};
 
 	static void AddGenericArgs(MangleContext& mangleContext, StringImpl& name, const SizedArrayImpl<BfType*>& genericArgs, int numOuterGenericParams = 0);
-	
+
 	static void AddStr(MangleContext& mangleContext, StringImpl& name, const StringImpl& str);
 	static void Mangle(MangleContext& mangleContext, StringImpl& name, BfType* type, bool useTypeList = false, bool isConst = false);
 	static void Mangle(MangleContext& mangleContext, StringImpl& name, BfTypeInstance* typeInst, bool isAlreadyStarted, bool isOuterType = false);
@@ -176,8 +176,8 @@ public:
 
 	void AddPrefix(MangleContext & mangleContext, StringImpl& name, int startIdx, const char * prefix);
 
-	static void AddSubIdx(StringImpl& name, int strIdx);	
-	static void AddTypeStart(MangleContext & mangleContext, StringImpl& name, BfType* type);	
+	static void AddSubIdx(StringImpl& name, int strIdx);
+	static void AddTypeStart(MangleContext & mangleContext, StringImpl& name, BfType* type);
 	static bool FindOrCreateNameSub(MangleContext& mangleContext, StringImpl& name, const NameSubstitute& newNameSub);
 
 public:
@@ -188,7 +188,7 @@ public:
 	static void MangleStaticFieldName(StringImpl& outStr, bool is64Bit, BfTypeInstance* type, const StringImpl& fieldName, BfType* fieldType = NULL);
 };
 
-// A "safe mangle" is used for reconnecting deleted types to their previous id. We make sure we never force a 
+// A "safe mangle" is used for reconnecting deleted types to their previous id. We make sure we never force a
 //  PopulateType with this kind of mangle, as referenced types may be deleted and marked as undefined
 class BfSafeMangler : public BfMSMangler
 {

File diff ditekan karena terlalu besar
+ 151 - 151
IDEHelper/Compiler/BfModule.cpp


File diff ditekan karena terlalu besar
+ 176 - 176
IDEHelper/Compiler/BfModule.h


File diff ditekan karena terlalu besar
+ 142 - 142
IDEHelper/Compiler/BfModuleTypeUtils.cpp


+ 10 - 11
IDEHelper/Compiler/BfNamespaceVisitor.cpp

@@ -6,14 +6,13 @@ USING_NS_BF;
 
 //////////////////////////////////////////////////////////////////////////
 
-
 void BfNamespaceVisitor::Visit(BfUsingDirective* usingDirective)
 {
 	if (usingDirective->mNamespace == NULL)
-	{		
+	{
 		return;
 	}
-	
+
 	String usingString = usingDirective->mNamespace->ToString();
 	BfAtomCompositeT<16> usingComposite;
 	mSystem->ParseAtomComposite(usingString, usingComposite);
@@ -24,11 +23,11 @@ void BfNamespaceVisitor::Visit(BfUsingDirective* usingDirective)
 }
 
 void BfNamespaceVisitor::Visit(BfUsingModDirective* usingDirective)
-{	
+{
 	BfAstNode* useNode = usingDirective->mTypeRef;
 	BfAstNode* checkNode = usingDirective->mTypeRef;
 	while (true)
-	{		
+	{
 		if (auto qualifiedTypeRef = BfNodeDynCast<BfQualifiedTypeReference>(checkNode))
 			checkNode = qualifiedTypeRef->mLeft;
 		else if (auto elementedTypeRef = BfNodeDynCast<BfElementedTypeRef>(checkNode))
@@ -42,9 +41,9 @@ void BfNamespaceVisitor::Visit(BfUsingModDirective* usingDirective)
 
 	if (useNode == NULL)
 		return;
-	
+
 	String usingString = useNode->ToString();
-	
+
 	BfAtomCompositeT<16> usingComposite;
 	if (mSystem->ParseAtomComposite(usingString, usingComposite))
 		mResolvePassData->HandleNamespaceReference(useNode, usingComposite);
@@ -53,7 +52,7 @@ void BfNamespaceVisitor::Visit(BfUsingModDirective* usingDirective)
 void BfNamespaceVisitor::Visit(BfNamespaceDeclaration* namespaceDeclaration)
 {
 	BfAtomCompositeT<16> prevNamespace = mNamespace;
-	
+
 	if (namespaceDeclaration->mNameNode == NULL)
 		return;
 
@@ -64,7 +63,7 @@ void BfNamespaceVisitor::Visit(BfNamespaceDeclaration* namespaceDeclaration)
 		if (dotIdx == -1)
 		{
 			BfAtom* namespaceAtom = mSystem->FindAtom(namespaceLeft);
-			mNamespace.Set(mNamespace.mParts, mNamespace.mSize, &namespaceAtom, 1);						
+			mNamespace.Set(mNamespace.mParts, mNamespace.mSize, &namespaceAtom, 1);
 			break;
 		}
 
@@ -76,7 +75,7 @@ void BfNamespaceVisitor::Visit(BfNamespaceDeclaration* namespaceDeclaration)
 	if (mResolvePassData->mAutoComplete != NULL)
 		mResolvePassData->mAutoComplete->CheckNamespace(namespaceDeclaration->mNameNode, mNamespace);
 	mResolvePassData->HandleNamespaceReference(namespaceDeclaration->mNameNode, mNamespace);
-	VisitChild(namespaceDeclaration->mBody);	
+	VisitChild(namespaceDeclaration->mBody);
 	mNamespace = prevNamespace;
 }
 
@@ -88,4 +87,4 @@ void BfNamespaceVisitor::Visit(BfBlock* block)
 void BfNamespaceVisitor::Visit(BfRootNode* rootNode)
 {
 	VisitMembers(rootNode);
-}
+}

+ 2 - 2
IDEHelper/Compiler/BfNamespaceVisitor.h

@@ -9,7 +9,7 @@ class BfResolvePassData;
 
 class BfNamespaceVisitor : public BfStructuralVisitor
 {
-public:	
+public:
 	BfSystem* mSystem;
 	BfResolvePassData* mResolvePassData;
 	BfAtomComposite mNamespace;
@@ -20,7 +20,7 @@ public:
 		mSystem = NULL;
 		mResolvePassData = NULL;
 	}
-	
+
 	virtual void Visit(BfUsingDirective* usingDirective) override;
 	virtual void Visit(BfUsingModDirective* usingDirective) override;
 	virtual void Visit(BfNamespaceDeclaration* namespaceDeclaration) override;

+ 92 - 101
IDEHelper/Compiler/BfParser.cpp

@@ -1,6 +1,5 @@
 #pragma warning(disable:4996)
 
-
 #include "BfParser.h"
 #include "BfReducer.h"
 #include "BfPrinter.h"
@@ -158,7 +157,7 @@ void BfParserCache::ReportMemory(MemReporter* memReporter)
 	int allocPages = 0;
 	int usedPages = 0;
 	mAstAllocManager.GetStats(allocPages, usedPages);
-	
+
 	OutputDebugStrF("Parsers: %d  Chars: %d  UsedAlloc: %dk  BytesPerChar: %d  SysAllocPages: %d  SysUsedPages: %d (%dk)  LargeAllocs: %dk\n", (int)mEntries.size(), srcLen, allocBytesUsed / 1024,
 		allocBytesUsed / BF_MAX(1, srcLen), allocPages, usedPages, (usedPages * BfAstAllocManager::PAGE_SIZE) / 1024, largeAllocs / 1024);
 
@@ -182,7 +181,6 @@ static int DecodeInt(uint8* buf, int& idx)
 		curByte = buf[idx++];
 		value |= ((curByte & 0x7f) << shift);
 		shift += 7;
-
 	} while (curByte >= 128);
 	// Sign extend negative numbers.
 	if (((curByte & 0x40) != 0) && (shift < 64))
@@ -192,14 +190,14 @@ static int DecodeInt(uint8* buf, int& idx)
 
 static int gCurDataId = 0;
 BfParserData::BfParserData()
-{		
+{
 	mDataId = (int)BfpSystem_InterlockedExchangeAdd32((uint32*)&gCurDataId, 1) + 1;
 
 	mHash = 0;
 	mRefCount = -1;
 	mJumpTable = NULL;
 	mJumpTableSize = 0;
-	mFailed = false;	
+	mFailed = false;
 	mCharIdData = NULL;
 	mUniqueParser = NULL;
 	mDidReduce = false;
@@ -239,7 +237,7 @@ int BfParserData::GetCharIdAtIndex(int findIndex)
 }
 
 void BfParserData::GetLineCharAtIdx(int idx, int& line, int& lineChar)
-{	
+{
 	if (mJumpTableSize <= 0)
 	{
 		line = 0;
@@ -348,7 +346,7 @@ BfParser::BfParser(BfSystem* bfSystem, BfProject* bfProject) : BfSource(bfSystem
 {
 	BfLogSys(bfSystem, "BfParser::BfParser %08X\n", this);
 
-	gParserCount++;	
+	gParserCount++;
 
 	mTextVersion = -1;
 	mEmbedKind = BfSourceEmbedKind_None;
@@ -374,15 +372,15 @@ BfParser::BfParser(BfSystem* bfSystem, BfProject* bfProject) : BfSource(bfSystem
 	mLineStart = 0;
 	//mCurToken = (BfSyntaxToken)0;
 	mToken = BfToken_None;
-	mSyntaxToken = BfSyntaxToken_None;	
+	mSyntaxToken = BfSyntaxToken_None;
 
 	mTokenStart = 0;
 	mTokenEnd = 0;
-	mLineNum = 0;	
+	mLineNum = 0;
 	mCompatMode = false;
 	mQuickCompatMode = false;
 	mLiteral.mWarnType = 0;
-	mDataId = -1;	
+	mDataId = -1;
 
 	mTriviaStart = 0;
 	mParsingFailed = false;
@@ -397,7 +395,6 @@ BfParser::BfParser(BfSystem* bfSystem, BfProject* bfProject) : BfSource(bfSystem
 	}
 }
 
-
 //static std::set<BfAstNode*> gFoundNodes;
 
 BfParser::~BfParser()
@@ -406,7 +403,6 @@ BfParser::~BfParser()
 
 	if (mParserData == NULL)
 	{
-
 	}
 	else if (mParserData->mRefCount == -1)
 	{
@@ -419,12 +415,12 @@ BfParser::~BfParser()
 		// Just never got added to the cache
 		delete mParserData;
 	}
-	else		
+	else
 	{
-		mParserData->Deref();		
+		mParserData->Deref();
 	}
 
-	mSourceData = NULL; 
+	mSourceData = NULL;
 
 	BfLogSys(mSystem, "BfParser::~BfParser %p\n", this);
 }
@@ -470,9 +466,9 @@ void BfParser::TokenFail(const StringImpl& error, int offset)
 void BfParser::Init(uint64 cacheHash)
 {
 	BF_ASSERT(mParserData == NULL);
-	
+
 	mParserData = new BfParserData();
-	mSourceData = mParserData;			
+	mSourceData = mParserData;
 	mParserData->mFileName = mFileName;
 	if (mDataId != -1)
 		mParserData->mDataId = mDataId;
@@ -481,7 +477,7 @@ void BfParser::Init(uint64 cacheHash)
 	mParserData->mAstAllocManager = &gBfParserCache->mAstAllocManager;
 	mParserData->mSrc = mSrc;
 	mParserData->mSrcLength = mSrcLength;
-		
+
 	if (cacheHash != 0)
 	{
 		BfLogSysM("Creating cached parserData %p for %p %s\n", mParserData, this, mFileName.c_str());
@@ -503,9 +499,9 @@ void BfParser::Init(uint64 cacheHash)
 
 	mParserData->mJumpTable = mJumpTable;
 	mParserData->mJumpTableSize = mJumpTableSize;
-	
+
 	mAlloc = &mParserData->mAlloc;
-	mAlloc->mSourceData = mSourceData;	
+	mAlloc->mSourceData = mSourceData;
 }
 
 void BfParser::NewLine()
@@ -529,7 +525,7 @@ void BfParser::SetSource(const char* data, int length)
 	const int EXTRA_BUFFER_SIZE = 80; // Extra chars for a bit of AllocChars room
 
 	//TODO: Check cache
-	// Don't cache if we have a Cursorid set, 
+	// Don't cache if we have a Cursorid set,
 	//  if mDataId != -1
 	//  if BfParerFlag != 0
 
@@ -570,7 +566,7 @@ void BfParser::SetSource(const char* data, int length)
 
 		BfParserCache::DataEntry* dataEntryP;
 		if (gBfParserCache->mEntries.TryGetWith(lookupEntry, &dataEntryP))
-		{						
+		{
 			mUsingCache = true;
 
 			mParserData = dataEntryP->mParserData;
@@ -595,7 +591,7 @@ void BfParser::SetSource(const char* data, int length)
 
 	mSrcLength = length;
 	mOrigSrcLength = length;
-	mSrcAllocSize = mSrcLength /*+ EXTRA_BUFFER_SIZE*/;	 
+	mSrcAllocSize = mSrcLength /*+ EXTRA_BUFFER_SIZE*/;
 	char* ownedSrc = new char[mSrcAllocSize + 1];
 	if (data != NULL)
 		memcpy(ownedSrc, data, length);
@@ -753,7 +749,7 @@ BfBlock* BfParser::ParseInlineBlock(int spaceIdx, int endIdx)
 			break;
 		if ((childNode->IsA<BfCommentNode>()))
 		{
-			mSidechannelRootNode->Add(childNode);			
+			mSidechannelRootNode->Add(childNode);
 			mPendingSideNodes.push_back(childNode);
 			continue;
 		}
@@ -798,7 +794,7 @@ void BfParser::HandlePragma(const StringImpl& pragma, BfBlock* block)
 	if (paramNode->ToStringView() == "warning")
 	{
 		++itr;
-		//auto iterNode = paramNode->mNext;		
+		//auto iterNode = paramNode->mNext;
 		//BfAstNode* iterNode = parentNode->mChildArr.GetAs<BfAstNode*>(++curIdx);
 
 		BfAstNode* iterNode = itr.Get();
@@ -863,11 +859,11 @@ void BfParser::HandlePragma(const StringImpl& pragma, BfBlock* block)
 	}
 	else if (paramNode->ToStringView() == "format")
 	{
-		++itr;		
+		++itr;
 		BfAstNode* iterNode = itr.Get();
 		if (iterNode)
 		{
-			if ((iterNode->ToStringView() != "disable") &&			
+			if ((iterNode->ToStringView() != "disable") &&
 				(iterNode->ToStringView() != "restore"))
 			{
 				mPassInstance->FailAfterAt("Expected \"disable\" or \"restore\" after \"format\"", mSourceData, paramNode->GetSrcEnd() - 1);
@@ -881,13 +877,13 @@ void BfParser::HandlePragma(const StringImpl& pragma, BfBlock* block)
 }
 
 void BfParser::HandleDefine(const StringImpl& name, BfAstNode* paramNode)
-{	
+{
 	mPreprocessorDefines[name] = BfDefineState_ManualSet;
 }
 
 void BfParser::HandleUndefine(const StringImpl& name)
 {
-	mPreprocessorDefines[name] = BfDefineState_ManualUnset;	
+	mPreprocessorDefines[name] = BfDefineState_ManualUnset;
 }
 
 MaybeBool BfParser::HandleIfDef(const StringImpl& name)
@@ -925,16 +921,14 @@ MaybeBool BfParser::HandleProcessorCondition(BfBlock* paramNode)
 
 void BfParser::HandleInclude(BfAstNode* paramNode)
 {
-
 }
 
 void BfParser::HandleIncludeNext(BfAstNode* paramNode)
 {
-
 }
 
 bool BfParser::HandlePreprocessor()
-{	
+{
 	int triviaStart = mTriviaStart;
 
 	int checkIdx = 0;
@@ -958,7 +952,7 @@ bool BfParser::HandlePreprocessor()
 	String pragmaParam;
 
 	switch (mSrc[mSrcIdx - 1])
-	{	
+	{
 	case '<':
 		if (mPreprocessorIgnoreDepth > 0)
 			return false;
@@ -967,15 +961,15 @@ bool BfParser::HandlePreprocessor()
 	case '=':
 		if (mPreprocessorIgnoreDepth > 0)
 			return false;
-		pragma = "===";	
-		break;	
+		pragma = "===";
+		break;
 	case '>':
 		if (mPreprocessorIgnoreDepth > 1)
-			return false;		
+			return false;
 		pragma = ">>>";
 		break;
 	}
-	
+
 	bool atEnd = false;
 
 	int startIdx = mSrcIdx - 1;
@@ -1003,7 +997,7 @@ bool BfParser::HandlePreprocessor()
 			}
 
 			if (!hadSlash)
-				break;			
+				break;
 		}
 
 		if (c == '\0')
@@ -1045,7 +1039,7 @@ bool BfParser::HandlePreprocessor()
 
 	BfBlock* paramNode = NULL;
 	if (pragma.IsEmpty())
-	{		
+	{
 		if (spaceIdx != -1)
 		{
 			pragma = String(mSrc + charIdx, mSrc + spaceIdx);
@@ -1234,7 +1228,7 @@ bool BfParser::HandlePreprocessor()
 				mPreprocessorNodeStack.pop_back();
 		}
 		else if (pragma == "define")
-		{			
+		{
 			if ((paramNode != NULL) && (!paramNode->mChildArr.IsEmpty()))
 				HandleDefine(paramNode->mChildArr[0]->ToString(), paramNode);
 			wantedParam = true;
@@ -1247,7 +1241,7 @@ bool BfParser::HandlePreprocessor()
 		}
 		else if (pragma == "error")
 		{
-			wantsSingleParam = false;			
+			wantsSingleParam = false;
 			mPassInstance->FailAt(pragmaParam, mSourceData, startIdx, mSrcIdx - startIdx);
 			wantedParam = true;
 		}
@@ -1370,7 +1364,6 @@ struct StrHashT<4>
 	{
 		const static int HASH = (StrHashT<3>::HASH) ^ Str[4];
 	};
-
 };
 
 // This is little endian only
@@ -1512,7 +1505,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 				if (mSrc[mSrcIdx + 1] == '=')
 				{
 					if (mSrc[mSrcIdx + 2] == '=')
-					{						
+					{
 						if (HandlePreprocessor())
 						{
 							// Conflict split
@@ -1782,7 +1775,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 			}
 			break;
 		case '$':
-						
+
 			c = mSrc[mSrcIdx];
 			if ((c == '\"') || (c == '@') || (c == '$'))
 			{
@@ -1795,7 +1788,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 		case '\'':
 		{
 			SizedArray<BfUnscopedBlock*, 4> interpolateExpressions;
-			
+
 			String lineHeader;
 			String strLiteral;
 			char startChar = c;
@@ -2139,9 +2132,9 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 									mPassInstance->FailAfterAt("Expected '}'", mSourceData, newBlock->GetSrcEnd() - 1);
 								}
 								mInAsmBlock = false;
-								interpolateExpressions.Add(newBlock);								
+								interpolateExpressions.Add(newBlock);
 							}
-							
+
 							if (interpolateSetting == 1)
 							{
 								for (int i = 0; i < braceCount - 1; i++)
@@ -2169,7 +2162,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 								braceCount++;
 								mSrcIdx++;
 							}
-							
+
 							bool isClosingBrace = false;
 
 							if (!interpolateExpressions.IsEmpty())
@@ -2186,14 +2179,14 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 									isClosingBrace = true;
 								}
 								else if (block->mCloseBrace->mSrcStart == mSrcIdx - braceCount)
-								{									
+								{
 									block->mCloseBrace->mSrcEnd = mSrcIdx - braceCount + interpolateSetting;
 									isClosingBrace = true;
 								}
 							}
 
 							if (interpolateSetting == 1)
-							{															
+							{
 								for (int i = 0; i < braceCount - 1; i++)
 									strLiteral += '}';
 							}
@@ -2222,7 +2215,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 			{
 				mTokenStart = stringStart;
 				stringStart = -1;
-			}			
+			}
 
 			mTriviaStart = triviaStart;
 			mTokenEnd = mSrcIdx;
@@ -2246,7 +2239,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 					{
 						bool isGraphemeCluster = false;
 
-						// There's no explicit unicode limit to how many diacriticals a grapheme cluster can contain, 
+						// There's no explicit unicode limit to how many diacriticals a grapheme cluster can contain,
 						// but we apply a limit for sanity for the purpose of this error
 						if (strLiteral.length() < 64)
 						{
@@ -2266,7 +2259,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 				{
 					mLiteral.mInt64 = (uint8)strLiteral[0];
 				}
-				
+
 				if (mLiteral.mInt64 >= 0x8000) // Use 0x8000 to remain UTF16-compatible
 					mLiteral.mTypeCode = BfTypeCode_Char32;
 				else if (mLiteral.mInt64 >= 0x80) // Use 0x80 to remain UTF8-compatible
@@ -2289,7 +2282,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 					interpolateExpr->mTriviaStart = mTriviaStart;
 					interpolateExpr->mSrcStart = mTokenStart;
 					interpolateExpr->mSrcEnd = mSrcIdx;
-					BfSizedArrayInitIndirect(interpolateExpr->mExpressions, interpolateExpressions, mAlloc);									
+					BfSizedArrayInitIndirect(interpolateExpr->mExpressions, interpolateExpressions, mAlloc);
 					mGeneratedNode = interpolateExpr;
 					mSyntaxToken = BfSyntaxToken_GeneratedNode;
 					mToken = BfToken_None;
@@ -2321,10 +2314,10 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 					if (!mPendingSideNodes.IsEmpty())
 					{
 						if (auto prevComment = BfNodeDynCast<BfCommentNode>(mPendingSideNodes.back()))
-						{							
+						{
 							// This is required for folding '///' style multi-line documentation into a single node
 							if (prevComment->GetTriviaStart() == mTriviaStart)
-							{								
+							{
 								auto prevCommentKind = GetCommentKind(prevComment->mSrcStart);
 
 								if ((!BfIsCommentBlock(commentKind)) && (commentKind == prevCommentKind))
@@ -2339,7 +2332,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 					if ((!handled) && (!disablePreprocessor))
 					{
 						auto bfCommentNode = mAlloc->Alloc<BfCommentNode>();
-						bfCommentNode->Init(this);						
+						bfCommentNode->Init(this);
 						bfCommentNode->mCommentKind = commentKind;
 						mSidechannelRootNode->Add(bfCommentNode);
 						mPendingSideNodes.push_back(bfCommentNode);
@@ -2547,7 +2540,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 			return;
 		default:
 			if (((c >= '0') && (c <= '9')) || (c == '-'))
-			{				
+			{
 				bool prevIsDot = prevToken == BfToken_Dot;
 
 				if (c == '-')
@@ -2577,7 +2570,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 					mTokenEnd = mSrcIdx;
 					return;
 				}
-				
+
 				bool hadOverflow = false;
 				uint64 val = 0;
 				int numberBase = 10;
@@ -2674,14 +2667,14 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 					{
 						// Skip float parsing if we have a double-dot `1..` case
 						hasDot = false;
-					}					
+					}
 
 					// The 'prevIsDot' helps tuple lookups like "tuple.0.0", interpreting those as two integers rather than a float
 					if (((hasDot) && (!prevIsDot)) || (hasExp))
 					{
 						// Switch to floating point mode
 						//double dVal = val;
-						//double dValScale = 0.1; 
+						//double dValScale = 0.1;
 						//if (hasExp)
 						//dVal *= pow(10, expVal);
 						while (true)
@@ -2796,7 +2789,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 					if (endNumber)
 					{
 						mTokenEnd = mSrcIdx - 1;
-						mSrcIdx--;						
+						mSrcIdx--;
 
 						if ((numberBase == 0x10) &&
 							((hexDigits >= 16) || ((hadSeps) && (hexDigits > 8)) || ((hadLeadingHexSep) && (hexDigits == 8))))
@@ -2815,7 +2808,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 							mLiteral.mTypeCode = BfTypeCode_IntUnknown;
 
 							if ((numberBase == 0x10) && (hexDigits == 7))
-								mLiteral.mWarnType = BfWarning_BF4201_Only7Hex;							
+								mLiteral.mWarnType = BfWarning_BF4201_Only7Hex;
 							if ((numberBase == 0x10) && (hexDigits == 9))
 								mLiteral.mWarnType = BfWarning_BF4202_TooManyHexForInt;
 
@@ -2830,9 +2823,9 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 								mLiteral.mTypeCode = BfTypeCode_UInt64;
 							}
 							else if (val > 0xFFFFFFFFLL)
-							{								
+							{
 								mLiteral.mTypeCode = BfTypeCode_Int64;
-							}							
+							}
 						}
 
 						mSyntaxToken = BfSyntaxToken_Literal;
@@ -2859,9 +2852,9 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 						val *= numberBase;
 						val += c - 'a' + 0xa;
 					}
-					
+
 					else if ((c == 'u') || (c == 'U'))
-					{						
+					{
 						if ((mSrc[mSrcIdx] == 'l') || (mSrc[mSrcIdx] == 'L'))
 						{
 							if (mSrc[mSrcIdx] == 'l')
@@ -2888,7 +2881,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 					else if ((c == 'l') || (c == 'L'))
 					{
 						if (c == 'l')
-							TokenFail("Uppercase 'L' required for int64");						
+							TokenFail("Uppercase 'L' required for int64");
 						if ((mSrc[mSrcIdx] == 'u') || (mSrc[mSrcIdx] == 'U'))
 						{
 							mSrcIdx++;
@@ -2901,12 +2894,12 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 								mPassInstance->FailAt("Value doesn't fit into uint64", mSourceData, mTokenStart, mSrcIdx - mTokenStart);
 							mSyntaxToken = BfSyntaxToken_Literal;
 							return;
-						}						
+						}
 						mTokenEnd = mSrcIdx;
 						mLiteral.mTypeCode = BfTypeCode_Int64;
 						mLiteral.mInt64 = (int64)val;
 						if (val == 0x8000000000000000)
-							mLiteral.mTypeCode = BfTypeCode_UInt64; 
+							mLiteral.mTypeCode = BfTypeCode_UInt64;
 						else if (val >= 0x8000000000000000)
 							hadOverflow = true;
 						if (numberBase == 0x10)
@@ -2938,14 +2931,14 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 					else
 					{
 						mTokenEnd = mSrcIdx - 1;
-						mSrcIdx--;						
+						mSrcIdx--;
 						mLiteral.mUInt64 = val;
 						mLiteral.mTypeCode = BfTypeCode_IntUnknown;
 						mSyntaxToken = BfSyntaxToken_Literal;
 						TokenFail("Unexpected character while parsing number", 0);
 						return;
 					}
-					
+
 					if ((uint64)prevVal > (uint64)val)
 						hadOverflow = true;
 				}
@@ -3188,7 +3181,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 						if (SrcPtrHasToken("new"))
 							mToken = BfToken_New;
 						break;
-					case TOKEN_HASH('n', 'u', 'l', 'l'):						
+					case TOKEN_HASH('n', 'u', 'l', 'l'):
 						if (SrcPtrHasToken("null"))
 							mToken = BfToken_Null;
 						else if (SrcPtrHasToken("nullable"))
@@ -3213,7 +3206,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 					case TOKEN_HASH('p', 'a', 'r', 'a'):
 						if ((!mCompatMode) && (SrcPtrHasToken("params")))
 							mToken = BfToken_Params;
-						break;					
+						break;
 					case TOKEN_HASH('p', 'r', 'i', 'v'):
 						if (SrcPtrHasToken("private"))
 							mToken = BfToken_Private;
@@ -3460,7 +3453,7 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
 		{
 			if (interpolateSetting == 0)
 				stringStart = mTokenStart;
-			interpolateSetting++;			
+			interpolateSetting++;
 		}
 	}
 }
@@ -3476,7 +3469,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
 	bool isAsmBlock = false;
 	bool isTernary = false;
 
-	SizedArray<BfAstNode*, 32> childArr;	
+	SizedArray<BfAstNode*, 32> childArr;
 
 	int parenDepth = 0;
 
@@ -3491,7 +3484,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
 		}
 
 		NextToken(-1, isInterpolate && (parenDepth == 0));
-		
+
 		if (mPreprocessorIgnoredSectionNode != NULL)
 		{
 			if (mSyntaxToken != BfSyntaxToken_EOF)
@@ -3508,7 +3501,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
 
 		gParseMemberIdx++;
 		int memberIdx = gParseMemberIdx;
-		
+
 		auto childNode = CreateNode();
 		if (childNode == NULL)
 			break;
@@ -3556,12 +3549,12 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
 			}
 			mInAsmBlock = false;
 			astNode->Add(newBlock);
-			childArr.push_back(newBlock);			
-		}		
+			childArr.push_back(newBlock);
+		}
 		else if (mToken == BfToken_RBrace)
 		{
 			if (depth == 0)
-				Fail("Unexpected ending brace");			
+				Fail("Unexpected ending brace");
 			break;
 		}
 		else
@@ -3578,7 +3571,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
 
 				bool endNow = false;
 				if (mToken == BfToken_Colon)
-				{	
+				{
 					endNow = true;
 					if (!childArr.IsEmpty())
 					{
@@ -3599,7 +3592,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
 
 				if (mToken == BfToken_Comma)
 					endNow = true;
-					
+
 				if (endNow)
 				{
 					mSrcIdx = mTokenStart;
@@ -3607,7 +3600,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
 				}
 			}
 
-			astNode->Add(childNode);			
+			astNode->Add(childNode);
 			childArr.Add(childNode);
 
 			if ((mSyntaxToken == BfSyntaxToken_Token) && (mToken == BfToken_RBrace))
@@ -3667,7 +3660,7 @@ void BfParser::Parse(BfPassInstance* passInstance)
 	mSyntaxToken = BfSyntaxToken_None;
 	mPassInstance = passInstance;
 
-	int startIdx = mSrcIdx;	
+	int startIdx = mSrcIdx;
 
 	if (mUsingCache)
 	{
@@ -3708,7 +3701,7 @@ void BfParser::Parse(BfPassInstance* passInstance)
 
 	if ((mPassInstance->HasMessages()) || (mParsingFailed))
 	{
-		mParserData->mFailed = true; // Don't reuse cache if there were errors or warnings		
+		mParserData->mFailed = true; // Don't reuse cache if there were errors or warnings
 	}
 
 	mPassInstance = NULL;
@@ -3739,18 +3732,18 @@ void BfParser::Close()
 		}
 		else
 		{
-			// It's possible two of the same entries were being parsed at the same time on different threads. 
+			// It's possible two of the same entries were being parsed at the same time on different threads.
 			//  Just let the loser be deleted in the dtor
 			BfLogSys(mSystem, "Duplicate parser %p not added to cache\n", this);
 		}
-	}	
+	}
 }
 
 void BfParser::HadSrcRealloc()
 {
 	int jumpTableSize = ((mSrcAllocSize + 1) + PARSER_JUMPTABLE_DIVIDE - 1) / PARSER_JUMPTABLE_DIVIDE;
 	if (jumpTableSize > mJumpTableSize)
-	{		
+	{
 		auto jumpTable = new BfLineStartEntry[jumpTableSize];
 		memset(jumpTable, 0, jumpTableSize * sizeof(BfLineStartEntry));
 		memcpy(jumpTable, mJumpTable, mJumpTableSize * sizeof(BfLineStartEntry));
@@ -3763,7 +3756,6 @@ void BfParser::HadSrcRealloc()
 		mParserData->mJumpTable = mJumpTable;
 		mParserData->mJumpTableSize = mJumpTableSize;
 	}
-	
 }
 
 void BfParser::GenerateAutoCompleteFrom(int srcPosition)
@@ -3782,7 +3774,7 @@ void BfParser::ReportMemory(MemReporter* memReporter)
 
 // 	if (!mUsingCache)
 // 		memReporter->AddBumpAlloc("AstAlloc", *mAlloc);
-// 
+//
 // 	memReporter->Add("JumpTable", mJumpTableSize * sizeof(BfLineStartEntry));
 
 	memReporter->Add(sizeof(BfParser));
@@ -3917,7 +3909,7 @@ BF_EXPORT void BF_CALLTYPE BfParser_SetNextRevision(BfParser* bfParser, BfParser
 
 BF_EXPORT void BF_CALLTYPE BfParser_SetCursorIdx(BfParser* bfParser, int cursorIdx)
 {
-	bfParser->SetCursorIdx(cursorIdx);	
+	bfParser->SetCursorIdx(cursorIdx);
 }
 
 BF_EXPORT void BF_CALLTYPE BfParser_SetIsClassifying(BfParser* bfParser)
@@ -3961,7 +3953,7 @@ BF_EXPORT bool BF_CALLTYPE BfParser_Reduce(BfParser* bfParser, BfPassInstance* b
 	BP_ZONE("BfParser_Reduce");
 	if (bfParser->mUsingCache)
 		return true; // Already reduced
-	
+
 	bfParser->FinishSideNodes();
 	int startFailIdx = bfPassInstance->mFailedIdx;
 	int startWarningCount = bfPassInstance->mWarningCount;
@@ -4013,7 +4005,7 @@ BF_EXPORT const char* BF_CALLTYPE BfParser_DocPrep(BfParser* bfParser)
 	bfPrinter.mCharMapping = &gCharMapping;
 	bfPrinter.mDocPrep = true;
 	bfPrinter.Visit(bfParser->mRootNode);
-	outString = bfPrinter.mOutString;	
+	outString = bfPrinter.mOutString;
 	return outString.c_str();
 }
 
@@ -4094,7 +4086,7 @@ BF_EXPORT BfResolvePassData* BF_CALLTYPE BfParser_CreateResolvePassData(BfParser
 }
 
 BF_EXPORT bool BF_CALLTYPE BfParser_BuildDefs(BfParser* bfParser, BfPassInstance* bfPassInstance, BfResolvePassData* resolvePassData, bool fullRefresh)
-{	
+{
 	if (bfParser->mCursorIdx != -1)
 		resolvePassData->mHasCursorIdx = true;
 
@@ -4108,7 +4100,6 @@ BF_EXPORT bool BF_CALLTYPE BfParser_BuildDefs(BfParser* bfParser, BfPassInstance
 
 BF_EXPORT void BF_CALLTYPE BfParser_RemoveDefs(BfParser* bfParser)
 {
-	
 }
 
 BF_EXPORT void BF_CALLTYPE BfParser_ClassifySource(BfParser* bfParser, BfSourceClassifier::CharData* charData, bool preserveFlags)
@@ -4117,18 +4108,18 @@ BF_EXPORT void BF_CALLTYPE BfParser_ClassifySource(BfParser* bfParser, BfSourceC
 		bfParser->Close();
 
 	BfSourceClassifier bfSourceClassifier(bfParser, charData);
-	bfSourceClassifier.mPreserveFlags = preserveFlags;	
+	bfSourceClassifier.mPreserveFlags = preserveFlags;
 	bfSourceClassifier.Visit(bfParser->mRootNode);
 	bfSourceClassifier.mIsSideChannel = false; //? false or true?
 	bfSourceClassifier.Visit(bfParser->mErrorRootNode);
 	bfSourceClassifier.mIsSideChannel = true;
-	bfSourceClassifier.Visit(bfParser->mSidechannelRootNode);	
+	bfSourceClassifier.Visit(bfParser->mSidechannelRootNode);
 }
 
 BF_EXPORT void BF_CALLTYPE BfParser_CreateClassifier(BfParser* bfParser, BfPassInstance* bfPassInstance, BfResolvePassData* resolvePassData, BfSourceClassifier::CharData* charData)
 {
 	resolvePassData->mIsClassifying = true;
-	bfParser->mSourceClassifier = new BfSourceClassifier(bfParser, charData);	
+	bfParser->mSourceClassifier = new BfSourceClassifier(bfParser, charData);
 	bfParser->mSourceClassifier->mClassifierPassId = bfPassInstance->mClassifierPassId;
 
 	if ((resolvePassData->mParsers.IsEmpty()) || (bfParser != resolvePassData->mParsers[0]))
@@ -4140,7 +4131,7 @@ BF_EXPORT void BF_CALLTYPE BfParser_CreateClassifier(BfParser* bfParser, BfPassI
 	bfParser->mSourceClassifier->mSkipMethodInternals = true;
 	bfParser->mSourceClassifier->mSkipTypeDeclarations = true;
 	if (charData != NULL)
-	{		
+	{
 		if ((doClassifyPass) && (bfParser->mRootNode != NULL))
 			bfParser->mSourceClassifier->Visit(bfParser->mRootNode);
 	}
@@ -4179,4 +4170,4 @@ BF_EXPORT void BF_CALLTYPE BfParser_GenerateAutoCompletionFrom(BfParser* bfParse
 BF_EXPORT void BF_CALLTYPE BfParser_SetCompleteParse(BfParser* bfParser)
 {
 	bfParser->mCompleteParse = true;
-}
+}

+ 40 - 40
IDEHelper/Compiler/BfParser.h

@@ -20,15 +20,15 @@ enum BfSyntaxToken
 {
 	BfSyntaxToken_None,
 	BfSyntaxToken_Token,
-	BfSyntaxToken_Identifier,	
+	BfSyntaxToken_Identifier,
 	BfSyntaxToken_CharQuote,
-	BfSyntaxToken_StringQuote,	
+	BfSyntaxToken_StringQuote,
 	BfSyntaxToken_ForwardSlash,
-	BfSyntaxToken_Literal,	
+	BfSyntaxToken_Literal,
 	BfSyntaxToken_CommentLine,
 	BfSyntaxToken_CommentBlock,
-	BfSyntaxToken_GeneratedNode,	
-	BfSyntaxToken_FAILED,	
+	BfSyntaxToken_GeneratedNode,
+	BfSyntaxToken_FAILED,
 	BfSyntaxToken_HIT_END_IDX,
 	BfSyntaxToken_EOF
 };
@@ -59,12 +59,12 @@ enum MaybeBool
 {
 	MaybeBool_None = -1,
 	MaybeBool_False = 0,
-	MaybeBool_True = 1,	
+	MaybeBool_True = 1,
 };
 
 class BfParserData : public BfSourceData
 {
-public:	
+public:
 	uint64 mHash;
 	int mDataId;
 	int mRefCount; // -1 = not cached
@@ -82,7 +82,7 @@ public:
 	Dictionary<int, BfParserWarningEnabledChange> mWarningEnabledChanges;
 	std::set<int> mUnwarns;
 	bool mFailed; // Don't cache if there's a warning or an error
-	bool mDidReduce;			
+	bool mDidReduce;
 
 public:
 	BfParserData();
@@ -95,11 +95,11 @@ public:
 	}
 
 	virtual BfParser* ToParser() override;
-	int GetCharIdAtIndex(int findIndex);	
+	int GetCharIdAtIndex(int findIndex);
 	void GetLineCharAtIdx(int idx, int& line, int& lineChar);
 	bool IsUnwarnedAt(BfAstNode* node);
 	bool IsWarningEnabledAtSrcIndex(int warningNumber, int srcIdx);
-	void ReportMemory(MemReporter* memReporter);	
+	void ReportMemory(MemReporter* memReporter);
 };
 
 class BfParserCache
@@ -115,7 +115,7 @@ public:
 	};
 
 	struct DataEntry
-	{		
+	{
 		BfParserData* mParserData;
 
 		bool operator==(const LookupEntry& lookup) const;
@@ -123,7 +123,7 @@ public:
 		{
 			return lookup.mParserData == mParserData;
 		}
-	};		
+	};
 
 public:
 	CritSect mCritSect;
@@ -131,7 +131,7 @@ public:
 	BfAstAllocManager mAstAllocManager;
 	HashSet<DataEntry> mEntries;
 
-public:	
+public:
 	BfParserCache();
 	~BfParserCache();
 	void ReportMemory(MemReporter* memReporter);
@@ -153,30 +153,30 @@ enum BfSourceEmbedKind : int8
 
 class BfParser : public BfSource
 {
-public:		
+public:
 	BfParserData* mParserData;
 	bool mUsingCache;
 
 	BfPassInstance* mPassInstance;
 	BfSourceClassifier* mSourceClassifier;
-	String mFileName;	
+	String mFileName;
 	int mTextVersion;
 	BfSourceEmbedKind mEmbedKind;
-	bool mAwaitingDelete;	
-	
+	bool mAwaitingDelete;
+
 	bool mCompatMode; // Does C++ compatible parsing
-	bool mQuickCompatMode;	
+	bool mQuickCompatMode;
 	bool mScanOnly;
 	bool mCompleteParse;
 	bool mIsEmitted;
 	BfLineStartEntry* mJumpTable;
 	int mJumpTableSize;
-	int mOrigSrcLength;	
+	int mOrigSrcLength;
 	int mDataId;
 
 	int mSrcIdx;
 	int mLineStart;
-	int mLineNum;	
+	int mLineNum;
 	bool mInAsmBlock;
 
 	BfParserFlag mParserFlags;
@@ -186,43 +186,43 @@ public:
 	BfSyntaxToken mSyntaxToken;
 	int mTriviaStart; // mTriviaStart < mTokenStart when there's leading whitespace
 	int mTokenStart;
-	int mTokenEnd;	
+	int mTokenEnd;
 	BfAstNode* mGeneratedNode;
-	BfVariant mLiteral;	
+	BfVariant mLiteral;
 	BfToken mToken;
 	BfPreprocesorIgnoredSectionNode* mPreprocessorIgnoredSectionNode;
 	int mPreprocessorIgnoreDepth;
 	Array< std::pair<BfAstNode*, bool> > mPreprocessorNodeStack;
 
 	Dictionary<String, BfDefineState> mPreprocessorDefines;
-	
-	std::set<int> mPreprocessorIgnoredSectionStarts;			
+
+	std::set<int> mPreprocessorIgnoredSectionStarts;
 
 public:
 	virtual void HandleInclude(BfAstNode* paramNode);
 	virtual void HandleIncludeNext(BfAstNode* paramNode);
 	virtual void HandlePragma(const StringImpl& pragma, BfBlock* block);
 	virtual void HandleDefine(const StringImpl& name, BfAstNode* paramNode);
-	virtual void HandleUndefine(const StringImpl& name);	
+	virtual void HandleUndefine(const StringImpl& name);
 	virtual MaybeBool HandleIfDef(const StringImpl& name);
 	virtual MaybeBool HandleProcessorCondition(BfBlock* paramNode);
 
-public:		
+public:
 	void Init(uint64 cacheHash = 0);
-	void NewLine();	
+	void NewLine();
 	BfExpression* CreateInlineExpressionFromNode(BfBlock* block);
 	bool EvaluatePreprocessor(BfExpression* expr);
 	BfBlock* ParseInlineBlock(int spaceIdx, int endIdx);
-	bool HandlePreprocessor();	
+	bool HandlePreprocessor();
 	bool IsUnwarnedAt(BfAstNode* node);
 	bool SrcPtrHasToken(const char* name);
 	uint32 GetTokenHash();
 	void ParseBlock(BfBlock* astNode, int depth, bool isInterpolate = false);
-	double ParseLiteralDouble();	
+	double ParseLiteralDouble();
 	void AddErrorNode(int startIdx, int endIdx);
-	BfCommentKind GetCommentKind(int startIdx);	
+	BfCommentKind GetCommentKind(int startIdx);
 
-public:	
+public:
 	BfParser(BfSystem* bfSystem, BfProject* bfProject = NULL);
 	~BfParser();
 
@@ -232,23 +232,23 @@ public:
 	void GetLineCharAtIdx(int idx, int& line, int& lineChar);
 
 	void Fail(const StringImpl& error, int offset = -1);
-	void TokenFail(const StringImpl& error, int offset = -1);	
-	
-	void SetSource(const char* data, int length);	
+	void TokenFail(const StringImpl& error, int offset = -1);
+
+	void SetSource(const char* data, int length);
 	void MoveSource(const char* data, int length); // Takes ownership of data ptr
 	void RefSource(const char* data, int length);
 	void MakeNegative(uint64& val, bool& hadOverflow);
 	void NextToken(int endIdx = -1, bool outerIsInterpolate = false, bool disablePreprocessor = false);
-	BfAstNode* CreateNode();	
-		
-	void Parse(BfPassInstance* passInstance);		
+	BfAstNode* CreateNode();
+
+	void Parse(BfPassInstance* passInstance);
 	int GetCharIdAtIndex(int findIndex);
 	virtual void Close() override;
 	virtual void HadSrcRealloc() override;
 
-	void GenerateAutoCompleteFrom(int srcPosition);	
-		
-	void ReportMemory(MemReporter* memReporter);	
+	void GenerateAutoCompleteFrom(int srcPosition);
+
+	void ReportMemory(MemReporter* memReporter);
 	void GetSrcPosition(int idx, int& lineNum, int& column);
 };
 

File diff ditekan karena terlalu besar
+ 138 - 144
IDEHelper/Compiler/BfPrinter.cpp


+ 24 - 25
IDEHelper/Compiler/BfPrinter.h

@@ -5,7 +5,6 @@
 
 NS_BF_BEGIN
 
-
 class BfPrinter : public BfElementVisitor
 {
 public:
@@ -26,10 +25,10 @@ public:
 	struct StateModify
 	{
 	public:
-		bool mExpectingSpace;		
+		bool mExpectingSpace;
 		int mWantNewLineIdx;
 		bool mDoingBlockOpen;
-		bool mDoingBlockClose;		
+		bool mDoingBlockClose;
 		int mWantVirtualIndent;
 		BfAstNode* mQueuedNode;
 
@@ -43,18 +42,18 @@ public:
 
 		void Clear()
 		{
-			mExpectingSpace = false;			
+			mExpectingSpace = false;
 			mDoingBlockOpen = false;
 			mDoingBlockClose = false;
 			mQueuedNode = NULL;
 		}
 	};
-	
+
 	BfSourceData* mSource;
 	BfParserData* mParser;
 
 	BfBlock::Iterator mSidechannelItr;
-	BfAstNode* mSidechannelNextNode;	
+	BfAstNode* mSidechannelNextNode;
 
 	BfBlock::Iterator mErrorItr;
 	BfAstNode* mErrorNextNode;
@@ -65,18 +64,18 @@ public:
 	int mCurSrcIdx;
 	Array<StateModify> mChildNodeQueue;
 	int mFormatStart;
-	int mFormatEnd;	
+	int mFormatEnd;
 	int mFormatDisableCount;
 	StateModify mNextStateModify;
-	
+
 	String mOutString;
-	bool mReformatting;		
+	bool mReformatting;
 	bool mIgnoreTrivia;
 	bool mDocPrep;
 	BlockState* mCurBlockState;
 	int mCurIndentLevel;
 	int mQueuedSpaceCount;
-	int mLastSpaceOffset; // Indent difference from original to new	
+	int mLastSpaceOffset; // Indent difference from original to new
 	bool mExpectingNewLine;
 	int mCurCol;
 	int mMaxCol;
@@ -86,19 +85,19 @@ public:
 
 	bool mIsFirstStatementInBlock;
 	bool mForceUseTrivia;
-	bool mInSideChannel;	
+	bool mInSideChannel;
 
 	int mStateModifyVirtualIndentLevel;
 	int mVirtualIndentLevel;
 	int mVirtualNewLineIdx;
-			
+
 	Array<int>* mCharMapping;
 	int mHighestCharId;
 
-public:	
+public:
 	BfPrinter(BfRootNode* rootNode, BfRootNode* sidechannelRootNode, BfRootNode* errorRootNode);
-		
-public:	
+
+public:
 	void Update(BfAstNode* bfAstNode);
 	bool CheckReplace(BfAstNode* astNode);
 	void FlushIndent();
@@ -106,7 +105,7 @@ public:
 	void Write(BfAstNode* node, int start, int len);
 	void WriteSourceString(BfAstNode* node);
 	void QueueVisitChild(BfAstNode* astNode);
-	void QueueVisitErrorNodes(BfRootNode* astNode);	
+	void QueueVisitErrorNodes(BfRootNode* astNode);
 	void FlushVisitChild();
 	void VisitChildWithPrecedingSpace(BfAstNode* bfAstNode);
 	void VisitChildWithProceedingSpace(BfAstNode* bfAstNode);
@@ -117,9 +116,9 @@ public:
 	void VisitChildNextLine(BfAstNode* node);
 	void DoBlockOpen(BfAstNode* prevNode, BfTokenNode* blockOpen, BfTokenNode* blockClose, bool queue, BlockState& blockState);
 	void DoBlockClose(BfAstNode* prevNode, BfTokenNode* blockOpen, BfTokenNode* blockClose, bool queue, BlockState& blockState);
-	void QueueMethodDeclaration(BfMethodDeclaration* methodDeclaration);	
+	void QueueMethodDeclaration(BfMethodDeclaration* methodDeclaration);
 	int CalcOrigLineSpacing(BfAstNode* bfAstNode, int* lineStartIdx);
-	void WriteIgnoredNode(BfAstNode* node);	
+	void WriteIgnoredNode(BfAstNode* node);
 	void CheckRawNode(BfAstNode* node);
 
 	virtual void Visit(BfAstNode* bfAstNode) override;
@@ -130,20 +129,20 @@ public:
 	virtual void Visit(BfExpressionStatement* exprStmt) override;
 	virtual void Visit(BfNamedExpression* namedExpr) override;
 	virtual void Visit(BfAttributedExpression* attribExpr) override;
-	virtual void Visit(BfStatement* stmt) override;	
+	virtual void Visit(BfStatement* stmt) override;
 	virtual void Visit(BfLabelableStatement* labelableStmt) override;
 
 	virtual void Visit(BfCommentNode* commentNode) override;
 	virtual void Visit(BfPreprocesorIgnoredSectionNode* preprocesorIgnoredSection) override;
 	virtual void Visit(BfPreprocessorNode* preprocessorNode) override;
 
-	virtual void Visit(BfAttributeDirective* attributeDirective) override;	
+	virtual void Visit(BfAttributeDirective* attributeDirective) override;
 	virtual void Visit(BfGenericParamsDeclaration* genericParams) override;
 	virtual void Visit(BfGenericOperatorConstraint* genericConstraints) override;
 	virtual void Visit(BfGenericConstraintsDeclaration* genericConstraints) override;
 	virtual void Visit(BfGenericArgumentsNode* genericArgumentsNode) override;
 
-	virtual void Visit(BfEmptyStatement* emptyStmt) override;	
+	virtual void Visit(BfEmptyStatement* emptyStmt) override;
 	virtual void Visit(BfTokenNode* tokenNode) override;
 	virtual void Visit(BfTokenPairNode* tokenPairNode) override;
 	virtual void Visit(BfUsingSpecifierNode* usingSpecifier) override;
@@ -156,7 +155,7 @@ public:
 	virtual void Visit(BfMixinExpression* mixinExpr) override;
 	virtual void Visit(BfSizedArrayCreateExpression* createExpr) override;
 	virtual void Visit(BfInitializerExpression* initExpr) override;
-	virtual void Visit(BfCollectionInitializerExpression* initExpr) override;	
+	virtual void Visit(BfCollectionInitializerExpression* initExpr) override;
 	virtual void Visit(BfTypeReference* typeRef) override;
 	virtual void Visit(BfNamedTypeReference* typeRef) override;
 	virtual void Visit(BfQualifiedTypeReference* qualifiedType) override;
@@ -172,7 +171,7 @@ public:
 	virtual void Visit(BfPointerTypeRef* typeRef) override;
 	virtual void Visit(BfNullableTypeRef* typeRef) override;
 	virtual void Visit(BfVariableDeclaration* varDecl) override;
-	virtual void Visit(BfParameterDeclaration* paramDecl) override;	
+	virtual void Visit(BfParameterDeclaration* paramDecl) override;
 	virtual void Visit(BfTypeOfExpression* typeOfExpr) override;
 	virtual void Visit(BfSizeOfExpression* sizeOfExpr) override;
 	virtual void Visit(BfOffsetOfExpression* offsetOfExpr) override;
@@ -181,11 +180,11 @@ public:
 	virtual void Visit(BfCheckTypeExpression* checkTypeExpr) override;
 	virtual void Visit(BfDynamicCastExpression* dynCastExpr) override;
 	virtual void Visit(BfCastExpression* castExpr) override;
-	virtual void Visit(BfDelegateBindExpression* invocationExpr) override;	
+	virtual void Visit(BfDelegateBindExpression* invocationExpr) override;
 	virtual void Visit(BfLambdaBindExpression* lambdaBindExpr) override;
 	virtual void Visit(BfObjectCreateExpression* invocationExpr) override;
 	virtual void Visit(BfBoxExpression* boxExpr) override;
-	virtual void Visit(BfInvocationExpression* invocationExpr) override;	
+	virtual void Visit(BfInvocationExpression* invocationExpr) override;
 	virtual void Visit(BfSwitchCase* switchCase) override;
 	virtual void Visit(BfWhenExpression* whenExpr) override;
 	virtual void Visit(BfSwitchStatement* switchStmt) override;

File diff ditekan karena terlalu besar
+ 136 - 146
IDEHelper/Compiler/BfReducer.cpp


+ 14 - 14
IDEHelper/Compiler/BfReducer.h

@@ -36,8 +36,8 @@ public:
 		CreateStmtFlags_NoCaseExpr = 1,
 		CreateStmtFlags_FindTrailingSemicolon = 2,
 		CreateStmtFlags_AllowUnterminatedExpression = 4,
-		CreateStmtFlags_AllowLocalFunction = 8,		
-		CreateStmtFlags_ForceVariableDecl = 0x10,		
+		CreateStmtFlags_AllowLocalFunction = 8,
+		CreateStmtFlags_ForceVariableDecl = 0x10,
 
 		CreateStmtFlags_To_CreateExprFlags_Mask = 1
 	};
@@ -127,7 +127,7 @@ public:
 		}
 	};
 
-public:	
+public:
 	BfAstAllocator* mAlloc;
 	BfSystem* mSystem;
 	BfSource* mSource;
@@ -141,12 +141,12 @@ public:
 	BfMethodDeclaration* mCurMethodDecl;
 	BfAstNode* mLastBlockNode;
 	bool mStmtHasError;
-	bool mPrevStmtHadError;	
+	bool mPrevStmtHadError;
 	bool mCompatMode; // Does C++ compatible parsing
 	bool mAllowTypeWildcard;
 	bool mIsFieldInitializer;
 	bool mInParenExpr;
-	bool mSkipCurrentNodeAssert;	
+	bool mSkipCurrentNodeAssert;
 	BfVisitorPos mVisitorPos;
 	int mDocumentCheckIdx;
 	SizedArray<BfNamespaceDeclaration*, 4> mCurNamespaceStack;
@@ -154,15 +154,15 @@ public:
 
 	int mAssertCurrentNodeIdx;
 
-public:	
+public:
 	BfAstNode* Fail(const StringImpl& errorMsg, BfAstNode* refNode);
 	BfAstNode* FailAfter(const StringImpl& errorMsg, BfAstNode* refNode);
 	void AddErrorNode(BfAstNode* astNode, bool removeNode = true);
-			
-public:		
+
+public:
 	bool StringEquals(BfAstNode* node, BfAstNode* node2);
 	bool IsSemicolon(BfAstNode* node);
-	BfTokenNode* ExpectTokenAfter(BfAstNode* node, BfToken token);	
+	BfTokenNode* ExpectTokenAfter(BfAstNode* node, BfToken token);
 	BfTokenNode* ExpectTokenAfter(BfAstNode* node, BfToken tokenA, BfToken tokenB);
 	BfTokenNode* ExpectTokenAfter(BfAstNode* node, BfToken tokenA, BfToken tokenB, BfToken tokenC);
 	BfTokenNode* ExpectTokenAfter(BfAstNode* node, BfToken tokenA, BfToken tokenB, BfToken tokenC, BfToken tokenD);
@@ -176,8 +176,8 @@ public:
 	bool IsNodeRelevant(BfAstNode* astNode);
 	bool IsNodeRelevant(BfAstNode* startNode, BfAstNode* endNode);
 	void MoveNode(BfAstNode* srcNode, BfAstNode* newOwner);
-	void ReplaceNode(BfAstNode* prevNode, BfAstNode* newNode);	
-	
+	void ReplaceNode(BfAstNode* prevNode, BfAstNode* newNode);
+
 	bool SetProtection(BfAstNode* parentNode, BfAstNode*& protectionNodeRef, BfTokenNode* tokenNode);
 	BfAstNode* CreateAllocNode(BfTokenNode* newNode);
 	BfAstNode* ReplaceTokenStarter(BfAstNode* astNode, int idx = -1, bool allowIn = false);
@@ -195,12 +195,12 @@ public:
 	void CreateQualifiedNames(BfAstNode* node);
 	BfFieldDtorDeclaration* CreateFieldDtorDeclaration(BfAstNode* srcNode);
 	BfFieldDeclaration* CreateFieldDeclaration(BfTokenNode* tokenNode, BfTypeReference* typeRef, BfIdentifierNode* nameIdentifier, BfFieldDeclaration* prevFieldDeclaration);
-	BfAttributeDirective* CreateAttributeDirective(BfTokenNode* startToken);	
+	BfAttributeDirective* CreateAttributeDirective(BfTokenNode* startToken);
 	BfStatement* CreateAttributedStatement(BfTokenNode* tokenNode, CreateStmtFlags createStmtFlags = CreateStmtFlags_None);
 	BfExpression* CreateAttributedExpression(BfTokenNode* tokenNode, bool onlyAllowIdentifier);
 	BfDelegateBindExpression* CreateDelegateBindExpression(BfAstNode* allocNode);
 	BfLambdaBindExpression* CreateLambdaBindExpression(BfAstNode* allocNode, BfTokenNode* parenToken = NULL);
-	BfCollectionInitializerExpression* CreateCollectionInitializerExpression(BfBlock* block);	
+	BfCollectionInitializerExpression* CreateCollectionInitializerExpression(BfBlock* block);
 	BfCollectionInitializerExpression* CreateCollectionInitializerExpression(BfTokenNode* openToken);
 	BfObjectCreateExpression* CreateObjectCreateExpression(BfAstNode* allocNode);
 	BfScopedInvocationTarget* CreateScopedInvocationTarget(BfAstNode*& targetRef, BfTokenNode* colonToken);
@@ -225,7 +225,7 @@ public:
 	BfTypeReference* DoCreateTypeRef(BfAstNode* identifierNode, CreateTypeRefFlags createTypeRefFlags = CreateTypeRefFlags_None, int endNode = -1);
 	BfTypeReference* CreateTypeRef(BfAstNode* identifierNode, CreateTypeRefFlags createTypeRefFlags = CreateTypeRefFlags_None);
 	BfTypeReference* CreateTypeRefAfter(BfAstNode* astNode, CreateTypeRefFlags createTypeRefFlags = CreateTypeRefFlags_None);
-	BfTypeReference* CreateRefTypeRef(BfTypeReference* elementType, BfTokenNode* refToken);	
+	BfTypeReference* CreateRefTypeRef(BfTypeReference* elementType, BfTokenNode* refToken);
 	bool ParseMethod(BfMethodDeclaration* methodDeclaration, SizedArrayImpl<BfParameterDeclaration*>* params, SizedArrayImpl<BfTokenNode*>* commas, bool alwaysIncludeBlock = false);
 	BfGenericArgumentsNode* CreateGenericArguments(BfTokenNode* tokenNode, bool allowPartial = false);
 	BfGenericParamsDeclaration* CreateGenericParamsDeclaration(BfTokenNode* tokenNode);

+ 14 - 14
IDEHelper/Compiler/BfResolvePass.cpp

@@ -1,14 +1,14 @@
-#include "BfResolvePass.h" 
+#include "BfResolvePass.h"
 #include "BfParser.h"
 #include "BfModule.h"
 
 USING_NS_BF;
 
 BfResolvePassData::BfResolvePassData()
-{	
+{
 	mGetSymbolReferenceKind = BfGetSymbolReferenceKind_None;
 
-	mSymbolReferenceTypeDef = NULL;	
+	mSymbolReferenceTypeDef = NULL;
 
 	mSymbolReferenceLocalIdx = -1;
 	mSymbolReferenceFieldIdx = -1;
@@ -31,7 +31,7 @@ BfResolvePassData::~BfResolvePassData()
 		auto parser = emitEntryKV.mValue.mParser;
 		if (parser != NULL)
 		{
-			delete parser->mSourceClassifier;			
+			delete parser->mSourceClassifier;
 			parser->mSourceClassifier = NULL;
 			parser->mParserFlags = ParserFlag_None;
 			parser->mCursorCheckIdx = -1;
@@ -56,7 +56,7 @@ void BfResolvePassData::RecordReplaceNode(BfAstNode* node)
 	auto parser = node->GetSourceData()->ToParserData();
 	if (node->GetSrcStart() >= parser->mSrcLength)
 		return;
-		
+
 	while (true)
 	{
 		if (auto qualifiedName = BfNodeDynCast<BfQualifiedNameNode>(node))
@@ -65,35 +65,35 @@ void BfResolvePassData::RecordReplaceNode(BfAstNode* node)
 		}
 		else
 			break;
-	}	
+	}
 
 	RecordReplaceNode(parser, node->GetSrcStart(), node->GetSrcLength());
 }
 
 void BfResolvePassData::HandleMethodReference(BfAstNode* node, BfTypeDef* typeDef, BfMethodDef* methodDef)
 {
-	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Method) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) && 
+	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Method) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) &&
 		(mSymbolReferenceMethodIdx == methodDef->mIdx))
 		RecordReplaceNode(node);
 }
 
 void BfResolvePassData::HandleFieldReference(BfAstNode* node, BfTypeDef* typeDef, BfFieldDef* fieldDef)
 {
-	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Field) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) && 
+	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Field) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) &&
 		(mSymbolReferenceFieldIdx == fieldDef->mIdx))
 		RecordReplaceNode(node);
 }
 
 void BfResolvePassData::HandlePropertyReference(BfAstNode* node, BfTypeDef* typeDef, BfPropertyDef* propDef)
 {
-	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Property) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) && 
+	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Property) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) &&
 		(mSymbolReferencePropertyIdx == propDef->mIdx))
 		RecordReplaceNode(node);
 }
 
 void BfResolvePassData::HandleLocalReference(BfIdentifierNode* identifier, BfTypeDef* typeDef, BfMethodDef* methodDef, int localVarIdx)
 {
-	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Local) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) && 
+	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Local) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) &&
 		(mSymbolReferenceMethodIdx == methodDef->mIdx) && (localVarIdx == mSymbolReferenceLocalIdx))
 		RecordReplaceNode(identifier);
 }
@@ -106,14 +106,14 @@ void BfResolvePassData::HandleTypeGenericParam(BfAstNode* node, BfTypeDef* typeD
 
 void BfResolvePassData::HandleMethodGenericParam(BfAstNode* node, BfTypeDef* typeDef, BfMethodDef* methodDef, int genericParamIdx)
 {
-	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_MethodGenericParam) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) && 
+	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_MethodGenericParam) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) &&
 		(mSymbolReferenceMethodIdx == methodDef->mIdx) && (genericParamIdx == mSymbolMethodGenericParamIdx))
 		RecordReplaceNode(node);
 }
 
 void BfResolvePassData::HandleLocalReference(BfIdentifierNode* identifier, BfIdentifierNode* origNameNode, BfTypeDef* typeDef, BfMethodDef* methodDef, int localVarIdx)
 {
-	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Local) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) && 
+	if ((mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Local) && (mSymbolReferenceTypeDef == typeDef->GetDefinition()) &&
 		(mSymbolReferenceMethodIdx == methodDef->mIdx) && (localVarIdx == mSymbolReferenceLocalIdx))
 	{
 		if (origNameNode == NULL)
@@ -122,7 +122,7 @@ void BfResolvePassData::HandleLocalReference(BfIdentifierNode* identifier, BfIde
 		int origLen = origNameNode->GetSrcLength();
 		int refLen = identifier->GetSrcLength();
 
-		// The lengths can be different if we have one or more @'s prepended	
+		// The lengths can be different if we have one or more @'s prepended
 		RecordReplaceNode(identifier->GetSourceData()->ToParserData(), identifier->GetSrcStart() + (refLen - origLen), origLen);
 	}
 }
@@ -215,4 +215,4 @@ BfSourceClassifier* BfResolvePassData::GetSourceClassifier(BfParser* parser)
 	if (parser == NULL)
 		return NULL;
 	return parser->mSourceClassifier;
-}
+}

+ 7 - 7
IDEHelper/Compiler/BfResolvePass.h

@@ -14,7 +14,7 @@ enum BfResolveType
 	BfResolveType_Autocomplete,
 	BfResolveType_Autocomplete_HighPri,
 	BfResolveType_GoToDefinition,
-	BfResolveType_GetSymbolInfo,	
+	BfResolveType_GetSymbolInfo,
 	BfResolveType_RenameSymbol,
 	BfResolveType_ShowFileSymbolReferences,
 	BfResolveType_GetNavigationData,
@@ -68,14 +68,14 @@ public:
 	BfAutoComplete* mAutoComplete;
 	Array<BfTypeDef*> mAutoCompleteTempTypes; // Contains multiple values when we have nested types
 	Dictionary<BfTypeDef*, BfStaticSearch> mStaticSearchMap;
-	Dictionary<BfTypeDef*, BfInternalAccessSet> mInternalAccessMap;	
+	Dictionary<BfTypeDef*, BfInternalAccessSet> mInternalAccessMap;
 	Array<BfAstNode*> mExteriorAutocompleteCheckNodes;
 
-	BfGetSymbolReferenceKind mGetSymbolReferenceKind;	
+	BfGetSymbolReferenceKind mGetSymbolReferenceKind;
 	String mQueuedReplaceTypeDef;
 	BfTypeDef* mSymbolReferenceTypeDef;
 	String mQueuedSymbolReferenceNamespace;
-	BfAtomComposite mSymbolReferenceNamespace;		
+	BfAtomComposite mSymbolReferenceNamespace;
 	int mSymbolReferenceLocalIdx;
 	int mSymbolReferenceFieldIdx;
 	int mSymbolReferenceMethodIdx;
@@ -85,7 +85,7 @@ public:
 	bool mIsClassifying;
 	bool mHasCursorIdx;
 	bool mHadEmits;
-	
+
 	typedef Dictionary<BfParserData*, String> FoundSymbolReferencesParserDataMap;
 	FoundSymbolReferencesParserDataMap mFoundSymbolReferencesParserData;
 	//std::vector<BfIdentifierNode*> mSymbolReferenceIdentifiers;
@@ -94,7 +94,7 @@ public:
 
 public:
 	void RecordReplaceNode(BfParserData* parser, int srcStart, int srcLen);
-	void RecordReplaceNode(BfAstNode* node);	
+	void RecordReplaceNode(BfAstNode* node);
 	BfAstNode* FindBaseNode(BfAstNode* node);
 
 public:
@@ -108,7 +108,7 @@ public:
 	void HandleMethodReference(BfAstNode* node, BfTypeDef* typeDef, BfMethodDef* methodDef);
 	void HandleFieldReference(BfAstNode* node, BfTypeDef* typeDef, BfFieldDef* fieldDef);
 	void HandlePropertyReference(BfAstNode* node, BfTypeDef* typeDef, BfPropertyDef* propDef);
-	void HandleTypeReference(BfAstNode* node, BfTypeDef* typeDef);	
+	void HandleTypeReference(BfAstNode* node, BfTypeDef* typeDef);
 	void HandleNamespaceReference(BfAstNode* node, const BfAtomComposite& namespaceName);
 
 	BfSourceClassifier* GetSourceClassifier(BfAstNode* astNode);

File diff ditekan karena terlalu besar
+ 136 - 139
IDEHelper/Compiler/BfResolvedTypeUtils.cpp


File diff ditekan karena terlalu besar
+ 153 - 155
IDEHelper/Compiler/BfResolvedTypeUtils.h


+ 7 - 7
IDEHelper/Compiler/BfSource.cpp

@@ -16,7 +16,7 @@ BfSource::BfSource(BfSystem* bfSystem)
 	if (bfSystem != NULL)
 		mAstAllocManager = &gBfParserCache->mAstAllocManager;
 	mSrc = NULL;
-	
+
 	mSrcLength = 0;
 	mSrcAllocSize = -1;
 
@@ -36,7 +36,7 @@ BfSource::BfSource(BfSystem* bfSystem)
 
 BfSource::~BfSource()
 {
-	int sourceCount = gSourceCount--;	
+	int sourceCount = gSourceCount--;
 
 	delete mSourceData;
 
@@ -65,7 +65,7 @@ BfErrorNode* BfSource::CreateErrorNode(BfAstNode* astNode)
 }
 
 void BfSource::AddErrorNode(BfAstNode* astNode)
-{	
+{
 	mPendingErrorNodes.push_back(CreateErrorNode(astNode));
 }
 
@@ -85,10 +85,10 @@ int BfSource::AllocChars(int charCount)
 		mSrcAllocSize = newAllocSize;
 
 		BF_ASSERT(mSourceData->ToParser() != NULL);
-		mSourceData->mSrc = mSrc;		
+		mSourceData->mSrc = mSrc;
 
 		HadSrcRealloc();
-	}	
+	}
 
 	int retVal = mSrcLength;
 	mSrcLength += charCount;
@@ -130,7 +130,7 @@ void BfSource::FinishSideNodes()
 }
 
 void BfSource::Close()
-{	
+{
 // 	if (mAlloc->mSource == NULL)
 // 	{
 // 		BF_ASSERT(mErrorRootNode == NULL);
@@ -149,4 +149,4 @@ void BfSource::Close()
 	}
 
 	mIsClosed = true;
-}
+}

+ 10 - 10
IDEHelper/Compiler/BfSource.h

@@ -21,7 +21,7 @@ public:
 		ExternalNodesState_Failed
 	};
 
-public:	
+public:
 	const char* mSrc;
 	int mSrcLength;
 	BfAstAllocManager* mAstAllocManager;
@@ -30,7 +30,7 @@ public:
 	BfRootNode* mSidechannelRootNode; // Holds comments and preprocessor nodes
 	BfRootNode* mRootNode;
 	BfRootNode* mErrorRootNode;
-	
+
 	BfSizedArray<BfExteriorNode> mExteriorNodes;
 	int mExteriorNodesCheckIdx; // 0 = unchecked, -1 = failed, >0 means success and equals the BfSystem.mTypesIdx
 
@@ -76,7 +76,7 @@ public:
 	BfAstAllocator* mAlloc;
 	const char* mSrc;
 	int mSrcLength;
-	int mSrcAllocSize;	
+	int mSrcAllocSize;
 	bool mParsingFailed;
 	bool mIsClosed;
 	uint8* mAstScratch;
@@ -86,28 +86,28 @@ public:
 	BfRootNode* mSidechannelRootNode; // Holds comments and preprocessor nodes
 	BfRootNode* mRootNode;
 	BfRootNode* mErrorRootNode;
-	
+
 	BfParser* mNextRevision;
 	BfParser* mPrevRevision;
 
 	SizedArray<BfAstNode*, 8> mPendingSideNodes;
 	SizedArray<BfAstNode*, 8> mPendingErrorNodes;
 
-public:	
+public:
 	bool WantsStats();
 
 public:
 	BfSource(BfSystem* bfSystem);
 	virtual ~BfSource();
 
-	virtual BfParser* ToParser() { return NULL; }	
+	virtual BfParser* ToParser() { return NULL; }
 	virtual void HadSrcRealloc() {}
-	
+
 	BfErrorNode* CreateErrorNode(BfAstNode* astNode);
-	void AddErrorNode(BfAstNode* astNode);	
-	int AllocChars(int charCount);	
+	void AddErrorNode(BfAstNode* astNode);
+	int AllocChars(int charCount);
 	void FinishSideNodes();
-	virtual void Close(); // Writing done, return unused pages but retain used pages	
+	virtual void Close(); // Writing done, return unused pages but retain used pages
 };
 
 NS_BF_END;

+ 42 - 43
IDEHelper/Compiler/BfSourceClassifier.cpp

@@ -8,7 +8,7 @@ BfSourceClassifier::BfSourceClassifier(BfParser* bfParser, CharData* charData)
 {
 	mParser = bfParser;
 	mCharData = charData;
-	mSkipMethodInternals = false;	
+	mSkipMethodInternals = false;
 	mSkipTypeDeclarations = false;
 	mSkipAttributes = false;
 	mIsSideChannel = false;
@@ -23,7 +23,7 @@ BfSourceClassifier::BfSourceClassifier(BfParser* bfParser, CharData* charData)
 void BfSourceClassifier::ModifyFlags(BfAstNode* node, uint8 andFlags, uint8 orFlags)
 {
 	if (node != NULL)
-	{		
+	{
 		ModifyFlags(node->GetSrcStart(), node->GetSrcEnd(), andFlags, orFlags);
 	}
 }
@@ -35,8 +35,8 @@ void BfSourceClassifier::ModifyFlags(int startPos, int endPos, uint8 andFlags, u
 
 	endPos = std::min(endPos, mParser->mOrigSrcLength);
 	for (int i = startPos; i < endPos; i++)
-	{			
-		mCharData[i].mDisplayPassId = mClassifierPassId;		
+	{
+		mCharData[i].mDisplayPassId = mClassifierPassId;
 		mCharData[i].mDisplayFlags = (mCharData[i].mDisplayFlags & andFlags) | orFlags;
 	}
 }
@@ -62,13 +62,13 @@ void BfSourceClassifier::SetElementType(BfAstNode * node, BfTypeCode typeCode)
 }
 
 void BfSourceClassifier::SetHighestElementType(int startPos, int endPos, BfSourceElementType elementType)
-{	
+{
 	if (!mEnabled)
 		return;
 
 	endPos = BF_MIN(endPos, mParser->mOrigSrcLength);
 	for (int i = startPos; i < endPos; i++)
-	{	
+	{
 		auto& charData = mCharData[i];
 		charData.mDisplayPassId = mClassifierPassId;
 		charData.mDisplayTypeId = BF_MAX(charData.mDisplayTypeId, (uint8)elementType);
@@ -100,15 +100,15 @@ void BfSourceClassifier::VisitMembers(BfBlock* node)
 {
 	mPrevNode = NULL;
 	for (auto& childNodeRef : *node)
-	{		
+	{
 		BfAstNode* child = childNodeRef;
 		child->Accept(this);
-		mPrevNode = child; 
+		mPrevNode = child;
 	}
 }
 
 bool BfSourceClassifier::IsInterestedInMember(BfAstNode* node, bool forceSkip)
-{	
+{
 	if ((mSkipMethodInternals || forceSkip) && (mParser->mCursorIdx != -1) &&
 		(!node->Contains(mParser->mCursorIdx, 1, 0)))
 		return false;
@@ -121,16 +121,16 @@ void BfSourceClassifier::HandleLeafNode(BfAstNode* node)
 		return;
 
 	int nodeStart = node->GetSrcStart();
-	int srcStart = nodeStart;	
+	int srcStart = nodeStart;
 	int triviaStart = node->GetTriviaStart();
 	if (triviaStart != -1)
 	{
 		srcStart = triviaStart;
-		
+
 		if ((mIsSideChannel) && (mPrevNode != NULL))
 			srcStart = std::max(mPrevNode->GetSrcEnd(), srcStart);
 	}
-	
+
 	if (nodeStart != srcStart)
 		SetElementType(srcStart, nodeStart, BfSourceElementType_Normal);
 	//SetElementType(srcStart, node->GetSrcEnd(), BfSourceElementType_Normal);
@@ -140,7 +140,6 @@ void BfSourceClassifier::HandleLeafNode(BfAstNode* node)
 
 void BfSourceClassifier::Visit(BfAstNode* node)
 {
-	
 }
 
 void BfSourceClassifier::Visit(BfErrorNode* errorNode)
@@ -153,7 +152,7 @@ void BfSourceClassifier::Visit(BfFieldDeclaration* fieldDecl)
 {
 	if (!IsInterestedInMember(fieldDecl))
 		return;
-	
+
 	BfElementVisitor::Visit(fieldDecl);
 
 	VisitChild(fieldDecl->mConstSpecifier);
@@ -188,12 +187,12 @@ void BfSourceClassifier::Visit(BfPreprocessorNode* preprocessorNode)
 	if (!mPreserveFlags)
 		ModifyFlags(preprocessorNode, ~BfSourceElementFlag_CompilerFlags_Mask, 0);
 	SetElementType(preprocessorNode, BfSourceElementType_Normal);
-	
-	Visit(preprocessorNode->ToBase());	
+
+	Visit(preprocessorNode->ToBase());
 }
 
 void BfSourceClassifier::Visit(BfCommentNode* commentNode)
-{	
+{
 	HandleLeafNode(commentNode);
 
 	Visit(commentNode->ToBase());
@@ -236,7 +235,7 @@ void BfSourceClassifier::Visit(BfAttributeDirective* attributeDirective)
 		}
 	}
 
-	BfElementVisitor::Visit(attributeDirective);	
+	BfElementVisitor::Visit(attributeDirective);
 
 	VisitChild(attributeDirective->mAttrCloseToken);
 
@@ -262,7 +261,7 @@ void BfSourceClassifier::Visit(BfAttributeDirective* attributeDirective)
 	for (auto& arg : attributeDirective->mArguments)
 		VisitChild(arg);
 	for (auto& comma : attributeDirective->mCommas)
-		VisitChild(comma);	
+		VisitChild(comma);
 
 	VisitChild(attributeDirective->mNextAttribute);
 }
@@ -280,7 +279,7 @@ void BfSourceClassifier::Visit(BfIdentifierNode* identifier)
 }
 
 void BfSourceClassifier::Visit(BfQualifiedNameNode* qualifiedName)
-{	
+{
 	Visit((BfAstNode*)qualifiedName);
 
 	VisitChild(qualifiedName->mLeft);
@@ -406,11 +405,11 @@ void BfSourceClassifier::Visit(BfLiteralExpression* literalExpr)
 void BfSourceClassifier::Visit(BfStringInterpolationExpression* stringInterpolationExpression)
 {
 	HandleLeafNode(stringInterpolationExpression);
-	
+
 	Visit(stringInterpolationExpression->ToBase());
 	SetElementType(stringInterpolationExpression, BfSourceElementType_Literal);
 
-	VisitChild(stringInterpolationExpression->mAllocNode);	
+	VisitChild(stringInterpolationExpression->mAllocNode);
 	for (auto& expr : stringInterpolationExpression->mExpressions)
 	{
 		SetElementType(expr, BfSourceElementType_Normal);
@@ -423,7 +422,7 @@ void BfSourceClassifier::Visit(BfTokenNode* tokenNode)
 	HandleLeafNode(tokenNode);
 
 	Visit(tokenNode->ToBase());
-	
+
 	if (BfTokenIsKeyword(tokenNode->GetToken()))
 		SetElementType(tokenNode, BfSourceElementType_Keyword);
 	else
@@ -436,15 +435,15 @@ void BfSourceClassifier::Visit(BfInvocationExpression* invocationExpr)
 	Visit(invocationExpr->ToBase());
 
 	//BP_ZONE("BfSourceClassifier BfInvocationExpression");
-	
+
 	BfAstNode* target = invocationExpr->mTarget;
 	if (target == NULL)
 		return;
-	
+
 	VisitChild(invocationExpr->mOpenParen);
 	VisitChild(invocationExpr->mCloseParen);
 	VisitChild(invocationExpr->mGenericArgs);
-	
+
 	if (auto scopedTarget = BfNodeDynCast<BfScopedInvocationTarget>(target))
 	{
 		VisitChild(target);
@@ -458,27 +457,27 @@ void BfSourceClassifier::Visit(BfInvocationExpression* invocationExpr)
 		VisitChild(qualifiedName->mLeft);
 		VisitChild(qualifiedName->mDot);
 		VisitChild(qualifiedName->mRight);
-		identifier = qualifiedName->mRight;		
+		identifier = qualifiedName->mRight;
 	}
 	else if ((identifier = BfNodeDynCast<BfIdentifierNode>(target)))
 	{
 		VisitChild(target);
 		// Leave as BfAttributedIdentifierNode if that's the case
-		identifier = target;		
+		identifier = target;
 	}
 	else if (auto qualifiedName = BfNodeDynCast<BfQualifiedNameNode>(target))
 	{
 		VisitChild(qualifiedName->mLeft);
 		VisitChild(qualifiedName->mDot);
 		VisitChild(qualifiedName->mRight);
-		identifier = qualifiedName->mRight;		
+		identifier = qualifiedName->mRight;
 	}
 	else if (auto memberRefExpr = BfNodeDynCast<BfMemberReferenceExpression>(target))
 	{
 		VisitChild(memberRefExpr->mTarget);
 		VisitChild(memberRefExpr->mDotToken);
 		VisitChild(memberRefExpr->mMemberName);
-		identifier = memberRefExpr->mMemberName;		
+		identifier = memberRefExpr->mMemberName;
 	}
 	else
 	{
@@ -490,9 +489,9 @@ void BfSourceClassifier::Visit(BfInvocationExpression* invocationExpr)
 		if (auto attrIdentifier = BfNodeDynCast<BfAttributedIdentifierNode>(identifier))
 		{
 			VisitChild(attrIdentifier->mAttributes);
-			identifier = attrIdentifier->mIdentifier;			
+			identifier = attrIdentifier->mIdentifier;
 		}
-		
+
 		if (identifier != NULL)
 			SetElementType(identifier, BfSourceElementType_Method);
 	}
@@ -551,7 +550,7 @@ void BfSourceClassifier::Visit(BfDestructorDeclaration* dtorDeclaration)
 }
 
 void BfSourceClassifier::Visit(BfMethodDeclaration* methodDeclaration)
-{	
+{
 	if (!IsInterestedInMember(methodDeclaration))
 		return;
 
@@ -559,8 +558,8 @@ void BfSourceClassifier::Visit(BfMethodDeclaration* methodDeclaration)
 
 	SetAndRestoreValue<BfAstNode*> prevMember(mCurMember, methodDeclaration);
 
-	BfElementVisitor::Visit(methodDeclaration);	
-	
+	BfElementVisitor::Visit(methodDeclaration);
+
 	SetElementType(methodDeclaration->mNameNode, BfSourceElementType_Method);
 
 	if (methodDeclaration->mGenericParams != NULL)
@@ -582,7 +581,7 @@ void BfSourceClassifier::Visit(BfMethodDeclaration* methodDeclaration)
 				if (typeRef != NULL)
 				{
 					if (auto namedTypeRef = BfNodeDynCast<BfNamedTypeReference>(typeRef))
-						SetElementType(typeRef, BfSourceElementType_GenericParam);						
+						SetElementType(typeRef, BfSourceElementType_GenericParam);
 					else
 						VisitChild(typeRef);
 				}
@@ -651,7 +650,7 @@ void BfSourceClassifier::Handle(BfTypeDeclaration* typeDeclaration)
 
 	llvm::SmallVector<BfTypeReference*, 2> mBaseClasses;
 	llvm::SmallVector<BfAstNode*, 2> mBaseClassCommas;
-	
+
 	if (typeDeclaration->mGenericParams != NULL)
 	{
 		for (auto& genericParam : typeDeclaration->mGenericParams->mGenericParams)
@@ -712,7 +711,7 @@ void BfSourceClassifier::Visit(BfTypeAliasDeclaration* typeDeclaration)
 	if (typeDeclaration->mIgnoreDeclaration)
 		return;
 
-	BfElementVisitor::Visit(typeDeclaration);	
+	BfElementVisitor::Visit(typeDeclaration);
 }
 
 void BfSourceClassifier::Visit(BfUsingDirective* usingDirective)
@@ -735,7 +734,7 @@ void BfSourceClassifier::Visit(BfUsingDirective* usingDirective)
 
 void BfSourceClassifier::Visit(BfUsingModDirective* usingDirective)
 {
-	BfElementVisitor::Visit(usingDirective);	
+	BfElementVisitor::Visit(usingDirective);
 }
 
 void BfSourceClassifier::Visit(BfNamespaceDeclaration* namespaceDeclaration)
@@ -760,7 +759,7 @@ bool BfSourceClassifier::WantsSkipParentMethod(BfAstNode* node)
 {
 	if (!mSkipMethodInternals)
 		return false;
-	
+
 #ifdef BF_AST_HAS_PARENT_MEMBER
 	if (node->mParent->IsA<BfMethodDeclaration>())
 	{
@@ -798,7 +797,7 @@ void BfSourceClassifier::Visit(BfGenericConstraintsDeclaration* genericConstrain
 }
 
 void BfSourceClassifier::Visit(BfBlock* block)
-{		
+{
 	if (WantsSkipParentMethod(block))
 		return;
 	if (block->mOpenBrace != NULL)
@@ -813,7 +812,7 @@ void BfSourceClassifier::Visit(BfRootNode* rootNode)
 	// Clear off the flags at the end
 	ModifyFlags(mParser->mRootNode->GetSrcEnd(), mParser->mOrigSrcLength, 0, 0);
 
-	VisitMembers(rootNode);	
+	VisitMembers(rootNode);
 }
 
 void BfSourceClassifier::Visit(BfInlineAsmStatement* asmStmt)
@@ -822,7 +821,7 @@ void BfSourceClassifier::Visit(BfInlineAsmStatement* asmStmt)
 		Visit(asmStmt->mOpenBrace);
 	if (asmStmt->mCloseBrace != NULL)
 		Visit(asmStmt->mCloseBrace);
-	
+
 	//VisitMembers(asmStmt);
 }
 

+ 11 - 11
IDEHelper/Compiler/BfSourceClassifier.h

@@ -12,7 +12,7 @@ enum BfSourceElementType
 	BfSourceElementType_Normal,
 	BfSourceElementType_Keyword,
 	BfSourceElementType_Literal,
-	BfSourceElementType_Identifier,	
+	BfSourceElementType_Identifier,
 	BfSourceElementType_Comment,
 	BfSourceElementType_Method,
 	BfSourceElementType_Type,
@@ -48,7 +48,7 @@ class BfSourceClassifier : public BfElementVisitor
 public:
 	struct CharData
 	{
-		char mChar;				
+		char mChar;
 		uint8 mDisplayPassId;
 		uint8 mDisplayTypeId;
 		uint8 mDisplayFlags;
@@ -58,8 +58,8 @@ public:
 	};
 
 public:
-	BfParser* mParser;	
-	CharData* mCharData;	
+	BfParser* mParser;
+	CharData* mCharData;
 	bool mEnabled;
 	bool mSkipMethodInternals;
 	bool mSkipTypeDeclarations;
@@ -96,7 +96,7 @@ public:
 	virtual void Visit(BfGenericConstraintsDeclaration* genericConstraints) override;
 
 	virtual void Visit(BfAstNode* node) override;
-	virtual void Visit(BfErrorNode* errorNode) override;		
+	virtual void Visit(BfErrorNode* errorNode) override;
 	virtual void Visit(BfFieldDeclaration* fieldDecl) override;
 	virtual void Visit(BfFieldDtorDeclaration* fieldDtorDecl) override;
 	virtual void Visit(BfPreprocesorIgnoredSectionNode* preprocesorIgnoredSection) override;
@@ -104,10 +104,10 @@ public:
 	virtual void Visit(BfCommentNode* commentNode) override;
 	virtual void Visit(BfAttributeDirective* attributeDirective) override;
 	virtual void Visit(BfIdentifierNode* identifier) override;
-	virtual void Visit(BfQualifiedNameNode* identifier) override;	
+	virtual void Visit(BfQualifiedNameNode* identifier) override;
 	virtual void Visit(BfThisExpression* thisExpr) override;
 	virtual void Visit(BfBaseExpression* baseExpr) override;
-	virtual void Visit(BfMemberReferenceExpression* memberRefExpr) override;	
+	virtual void Visit(BfMemberReferenceExpression* memberRefExpr) override;
 	virtual void Visit(BfQualifiedTypeReference* qualifiedType) override;
 	virtual void Visit(BfRefTypeRef* typeRef) override;
 	virtual void Visit(BfArrayTypeRef* arrayType) override;
@@ -118,11 +118,11 @@ public:
 	virtual void Visit(BfLiteralExpression* literalExpr) override;
 	virtual void Visit(BfStringInterpolationExpression* stringInterpolationExpression) override;
 	virtual void Visit(BfTokenNode* tokenNode) override;
-	virtual void Visit(BfInvocationExpression* invocationExpr) override;	
+	virtual void Visit(BfInvocationExpression* invocationExpr) override;
 	virtual void Visit(BfIndexerExpression* indexerExpr) override;
-	virtual void Visit(BfConstructorDeclaration* ctorDeclaration) override;	
-	virtual void Visit(BfDestructorDeclaration* dtorDeclaration) override;	
-	virtual void Visit(BfMethodDeclaration* methodDeclaration) override;	
+	virtual void Visit(BfConstructorDeclaration* ctorDeclaration) override;
+	virtual void Visit(BfDestructorDeclaration* dtorDeclaration) override;
+	virtual void Visit(BfMethodDeclaration* methodDeclaration) override;
 	virtual void Visit(BfPropertyMethodDeclaration* propertyMethodDeclaration) override;
 	virtual void Visit(BfPropertyDeclaration* propertyDeclaration) override;
 	virtual void Visit(BfTypeDeclaration* typeDeclaration) override;

+ 2 - 2
IDEHelper/Compiler/BfSourcePositionFinder.cpp

@@ -13,5 +13,5 @@ BfSourcePositionFinder::BfSourcePositionFinder(BfParser* bfParser, int findPosit
 void BfSourcePositionFinder::Visit(BfAstNode* node)
 {
 	if ((mFindPosition >= node->GetSrcStart()) && (mFindPosition <= node->GetSrcEnd()))
-		mClosestElement = node;	
-}
+		mClosestElement = node;
+}

+ 1 - 1
IDEHelper/Compiler/BfSourcePositionFinder.h

@@ -16,7 +16,7 @@ public:
 	BfSourcePositionFinder(BfParser* bfParser, int findPosition);
 
 	using BfStructuralVisitor::Visit;
-	virtual void Visit(BfAstNode* node) override;	
+	virtual void Visit(BfAstNode* node) override;
 };
 
 NS_BF_END

File diff ditekan karena terlalu besar
+ 150 - 151
IDEHelper/Compiler/BfStmtEvaluator.cpp


File diff ditekan karena terlalu besar
+ 142 - 144
IDEHelper/Compiler/BfSystem.cpp


+ 149 - 155
IDEHelper/Compiler/BfSystem.h

@@ -56,7 +56,7 @@ public:
 	uint32 mAtomUpdateIdx;
 	bool mIsSystemType;
 	Dictionary<BfAtom*, int> mPrevNamesMap;
-	
+
 public:
 	~BfAtom();
 	const StringView& ToString()
@@ -68,7 +68,7 @@ public:
 		str += mString;
 	}
 
-	void Ref();		
+	void Ref();
 };
 
 class BfAtomComposite
@@ -80,15 +80,15 @@ public:
 	bool mOwns;
 
 public:
-	BfAtomComposite();	
+	BfAtomComposite();
 	BfAtomComposite(BfAtomComposite&& rhs);
 	BfAtomComposite(const BfAtomComposite& rhs);
-	BfAtomComposite(BfAtom* atom);	
+	BfAtomComposite(BfAtom* atom);
 	BfAtomComposite(const BfAtomComposite& left, const BfAtomComposite& right);
 	BfAtomComposite(const BfAtomComposite& left, BfAtom* right);
 	~BfAtomComposite();
-	
-	void Set(const BfAtomComposite& left, const BfAtomComposite& right);	
+
+	void Set(const BfAtomComposite& left, const BfAtomComposite& right);
 	void Set(BfAtom** atomsA, int countA, BfAtom** atomsB, int countB);
 	BfAtomComposite& operator=(const BfAtomComposite& rhs);
 	bool operator==(const BfAtomComposite& other) const;
@@ -102,7 +102,7 @@ public:
 	bool EndsWith(const BfAtomComposite& other) const;
 	BfAtomComposite GetSub(int start, int len) const;
 	void Reference(const BfAtomComposite& other);
-	
+
 	uint32 GetAtomUpdateIdx();
 };
 
@@ -138,17 +138,17 @@ class BfSizedAtomComposite : public BfAtomComposite
 public:
 	BfAtom* mInitialAlloc[8];
 
-	BfSizedAtomComposite();	
-	~BfSizedAtomComposite();	
+	BfSizedAtomComposite();
+	~BfSizedAtomComposite();
 };
 
 struct BfAtomCompositeHash
 {
 	size_t operator()(const BfAtomComposite& composite) const
 	{
-		int curHash = 0;				
- 		for (int i = 0; i < (int)composite.mSize; i++)		
- 			curHash = ((curHash ^ (int)(intptr)composite.mParts[i]->mHash) << 5) - curHash;		
+		int curHash = 0;
+ 		for (int i = 0; i < (int)composite.mSize; i++)
+ 			curHash = ((curHash ^ (int)(intptr)composite.mParts[i]->mHash) << 5) - curHash;
 		return curHash;
 	}
 };
@@ -179,7 +179,7 @@ enum BfCompilerOptionFlags
 	BfCompilerOptionFlag_EmitLineInfo = 2,
 	BfCompilerOptionFlag_WriteIR = 4,
 	BfCompilerOptionFlag_GenerateOBJ = 8,
-	BfCompilerOptionFlag_GenerateBitcode = 0x10,	
+	BfCompilerOptionFlag_GenerateBitcode = 0x10,
 	BfCompilerOptionFlag_ClearLocalVars = 0x20,
 	BfCompilerOptionFlag_RuntimeChecks = 0x40,
 	BfCompilerOptionFlag_EmitDynamicCastCheck = 0x80,
@@ -190,7 +190,7 @@ enum BfCompilerOptionFlags
 	BfCompilerOptionFlag_EnableSideStack    = 0x1000,
 	BfCompilerOptionFlag_EnableHotSwapping  = 0x2000,
 	BfCompilerOptionFlag_IncrementalBuild   = 0x4000,
-	BfCompilerOptionFlag_DebugAlloc         = 0x8000, 
+	BfCompilerOptionFlag_DebugAlloc         = 0x8000,
 	BfCompilerOptionFlag_OmitDebugHelpers   = 0x10000,
 	BfCompilerOptionFlag_NoFramePointerElim = 0x20000,
 	BfCompilerOptionFlag_ArithmeticChecks = 0x40000,
@@ -234,7 +234,7 @@ enum BfMethodFlags
 	BfMethodFlags_FastCall = 0x2000,
 	BfMethodFlags_ThisCall = 0x3000,
 	BfMethodFlags_Mutating = 0x4000,
-	BfMethodFlags_Constructor = 0x8000	
+	BfMethodFlags_Constructor = 0x8000
 };
 
 enum BfObjectFlags : uint8
@@ -344,7 +344,7 @@ enum BfLTOType
 };
 
 enum BfCFLAAType
-{ 
+{
 	BfCFLAAType_None,
 	BfCFLAAType_Steensgaard,
 	BfCFLAAType_Andersen,
@@ -354,11 +354,11 @@ enum BfCFLAAType
 enum BfRelocType
 {
 	BfRelocType_NotSet,
-	BfRelocType_Static, 
-	BfRelocType_PIC, 
+	BfRelocType_Static,
+	BfRelocType_PIC,
 	BfRelocType_DynamicNoPIC,
 	BfRelocType_ROPI,
-	BfRelocType_RWPI, 
+	BfRelocType_RWPI,
 	BfRelocType_ROPI_RWPI
 };
 
@@ -366,32 +366,32 @@ enum BfPICLevel
 {
 	BfPICLevel_NotSet,
 	BfPICLevel_Not,
-	BfPICLevel_Small, 
+	BfPICLevel_Small,
 	BfPICLevel_Big
 };
 
 struct BfCodeGenOptions
-{	
+{
 	bool mIsHotCompile;
 
 	bool mWriteObj;
 	bool mWriteBitcode;
 	BfAsmKind mAsmKind;
 	bool mWriteToLib;
-	bool mWriteLLVMIR;	
+	bool mWriteLLVMIR;
 
 	int16 mVirtualMethodOfs;
 	int16 mDynSlotOfs;
 
 	BfRelocType mRelocType;
 	BfPICLevel mPICLevel;
-	BfSIMDSetting mSIMDSetting;	
+	BfSIMDSetting mSIMDSetting;
 	BfOptLevel mOptLevel;
 	BfLTOType mLTOType;
 	int mSizeLevel;
 	BfCFLAAType mUseCFLAA;
 	bool mUseNewSROA;
-	
+
 	bool mDisableTailCalls;
 	bool mDisableUnitAtATime;
 	bool mDisableUnrollLoops;
@@ -410,7 +410,7 @@ struct BfCodeGenOptions
 	bool mUseGVNAfterVectorization;
 	bool mEnableLoopInterchange;
 	bool mEnableLoopLoadElim;
-	bool mExtraVectorizerPasses;	
+	bool mExtraVectorizerPasses;
 	bool mEnableEarlyCSEMemSSA;
 	bool mEnableGVNHoist;
 	bool mEnableGVNSink;
@@ -427,8 +427,8 @@ struct BfCodeGenOptions
 	Val128 mHash;
 
 	BfCodeGenOptions()
-	{	
-		mIsHotCompile = false;		
+	{
+		mIsHotCompile = false;
 		mWriteObj = true;
 		mWriteBitcode = false;
 		mAsmKind = BfAsmKind_None;
@@ -436,7 +436,7 @@ struct BfCodeGenOptions
 		mWriteLLVMIR = false;
 		mVirtualMethodOfs = 0;
 		mDynSlotOfs = 0;
-		
+
 		mRelocType = BfRelocType_NotSet;
 		mPICLevel = BfPICLevel_NotSet;
 		mSIMDSetting = BfSIMDSetting_None;
@@ -445,7 +445,7 @@ struct BfCodeGenOptions
 		mSizeLevel = 0;
 		mUseCFLAA = BfCFLAAType_None;
 		mUseNewSROA = false;
-				
+
 		mDisableTailCalls = false;
 		mDisableUnitAtATime = false;
 		mDisableUnrollLoops = false;
@@ -480,7 +480,7 @@ struct BfCodeGenOptions
 	}
 
 	void GenerateHash()
-	{		
+	{
 		HashContext hashCtx;
 
 		hashCtx.Mixin(mWriteObj);
@@ -524,7 +524,6 @@ struct BfCodeGenOptions
 	}
 };
 
-
 enum BfParamKind : uint8
 {
 	BfParamKind_Normal,
@@ -547,7 +546,7 @@ class BfParameterDef
 {
 public:
 	String mName;
-	BfTypeReference* mTypeRef;	
+	BfTypeReference* mTypeRef;
 	BfParameterDeclaration* mParamDeclaration;
 	int mMethodGenericParamIdx;
 	BfParamKind mParamKind;
@@ -559,7 +558,7 @@ public:
 		mTypeRef = NULL;
 		mMethodGenericParamIdx = -1;
 		mParamKind = BfParamKind_Normal;
-		mParamDeclaration = NULL;		
+		mParamDeclaration = NULL;
 		mNamePrefixCount = 0;
 	}
 	void SetName(BfAstNode* nameNode);
@@ -579,7 +578,7 @@ public:
 	bool mIsStatic;
 	BfShow mShow;
 	bool mIsReadOnly;
-	bool mHasMultiDefs;	
+	bool mHasMultiDefs;
 
 public:
 	BfMemberDef()
@@ -603,25 +602,25 @@ public:
 class BfFieldDef : public BfMemberDef
 {
 public:
-	int mIdx;	
-	bool mIsConst; // Note: Consts are also all considered Static		
+	int mIdx;
+	bool mIsConst; // Note: Consts are also all considered Static
 	BfTypeReference* mTypeRef;
 	BfProtection mUsingProtection;
 	bool mIsInline;
 	bool mIsVolatile;
-	bool mIsExtern;	
+	bool mIsExtern;
 	bool mIsAppend;
-	bool mIsProperty;	
+	bool mIsProperty;
 	BfAstNode* mFieldDeclaration;
 	// It may seem that fields and properties don't need a 'mNextWithSameName', but with extensions it's possible
-	//  to have two libraries which each add a field to a type with the same name	
+	//  to have two libraries which each add a field to a type with the same name
 	BfFieldDef* mNextWithSameName;
 
 public:
 	BfFieldDef()
 	{
 		mIdx = 0;
-		mIsConst = false;		
+		mIsConst = false;
 		mTypeRef = NULL;
 		mUsingProtection = BfProtection_Hidden;
 		mIsInline = false;
@@ -686,7 +685,7 @@ public:
 			return paramDecl->mInitializer;
 		return NULL;
 	}
-	
+
 	BfAstNode* GetNameNode()
 	{
 		if (auto fieldDecl = GetFieldDeclaration())
@@ -699,18 +698,18 @@ public:
 
 class BfPropertyDef : public BfFieldDef
 {
-public:	
-	Array<BfMethodDef*> mMethods;	
+public:
+	Array<BfMethodDef*> mMethods;
 	BfPropertyDef* mNextWithSameName;
 
 public:
 	BfPropertyDef()
-	{		
+	{
 		mNextWithSameName = NULL;
-	}	
+	}
 
 	bool IsVirtual();
-	bool HasExplicitInterface();	
+	bool HasExplicitInterface();
 	bool IsExpressionBodied();
 	BfAstNode* GetRefNode();
 };
@@ -722,7 +721,7 @@ enum BfGenericParamFlags : uint16
 	BfGenericParamFlag_Struct		= 2,
 	BfGenericParamFlag_StructPtr	= 4,
 	BfGenericParamFlag_Enum			= 8,
-	BfGenericParamFlag_Interface	= 0x10,	
+	BfGenericParamFlag_Interface	= 0x10,
 	BfGenericParamFlag_Concrete		= 0x20,
 	BfGenericParamFlag_New			= 0x40,
 	BfGenericParamFlag_Delete		= 0x80,
@@ -768,10 +767,10 @@ public:
 
 class BfGenericParamDef : public BfConstraintDef
 {
-public:	
-	String mName;		
+public:
+	String mName;
 	Array<BfIdentifierNode*> mNameNodes; // 0 is always the def name
-	
+
 	bool operator==(const BfGenericParamDef& other) const
 	{
 		if (mName != other.mName)
@@ -788,7 +787,7 @@ public:
 class BfExternalConstraintDef : public BfConstraintDef
 {
 public:
-	BfTypeReference* mTypeRef;	
+	BfTypeReference* mTypeRef;
 };
 
 // CTOR is split into two for Objects - Ctor clears and sets up VData, Ctor_Body executes ctor body code
@@ -814,7 +813,7 @@ enum BfCallingConvention : uint8
 	BfCallingConvention_Unspecified,
 	BfCallingConvention_Cdecl,
 	BfCallingConvention_Stdcall,
-	BfCallingConvention_Fastcall,	
+	BfCallingConvention_Fastcall,
 };
 
 #define BF_METHODNAME_MARKMEMBERS "GCMarkMembers"
@@ -866,9 +865,9 @@ enum BfComptimeFlags : int8
 
 class BfMethodDef : public BfMemberDef
 {
-public:		
-	BfAstNode* mMethodDeclaration;					
-	BfAstNode* mBody;	
+public:
+	BfAstNode* mMethodDeclaration;
+	BfAstNode* mBody;
 
 	BfTypeReference* mExplicitInterface;
 	BfTypeReference* mReturnTypeRef;
@@ -893,7 +892,7 @@ public:
 	bool mWantsBody;
 	bool mCLink;
 	bool mHasAppend;
-	bool mAlwaysInline;	
+	bool mAlwaysInline;
 	bool mIsNoReturn;
 	bool mIsMutating;
 	bool mIsNoSplat;
@@ -901,14 +900,14 @@ public:
 	bool mIsSkipCall;
 	bool mHasComptime;
 	bool mIsOperator;
-	bool mIsExtern;	
+	bool mIsExtern;
 	bool mIsNoDiscard;
 	bool mHasExplicitThis;
 	bool mAddedAfterEmit;
 	BfCommutableKind mCommutableKind;
 	BfCheckedKind mCheckedKind;
-	BfImportKind mImportKind;	
-	BfCallingConvention mCallingConvention;	
+	BfImportKind mImportKind;
+	BfCallingConvention mCallingConvention;
 
 public:
 	BfMethodDef()
@@ -923,7 +922,7 @@ public:
 		mIsStatic = false;
 		mIsNew = false;
 		mIsPartial = false;
-		mCLink = false;		
+		mCLink = false;
 		mIsNoReturn = false;
 		mIsMutating = false;
 		mIsNoSplat = false;
@@ -958,16 +957,16 @@ public:
 	bool HasNoThisSplat() { return mIsMutating || mIsNoSplat; }
 	void Reset();
 	void FreeMembers();
-	BfMethodDeclaration* GetMethodDeclaration();	
+	BfMethodDeclaration* GetMethodDeclaration();
 	BfPropertyMethodDeclaration* GetPropertyMethodDeclaration();
 	BfPropertyDeclaration* GetPropertyDeclaration();
 	BfAstNode* GetRefNode();
-	BfTokenNode* GetMutNode();	
+	BfTokenNode* GetMutNode();
 	bool HasBody();
-	bool IsEmptyPartial();	
+	bool IsEmptyPartial();
 	bool IsDefaultCtor();
 	bool IsCtorOrInit();
-	String ToString();		
+	String ToString();
 	int GetExplicitParamCount();
 	void BuildParamNameMap();
 };
@@ -975,7 +974,7 @@ public:
 class BfOperatorDef : public BfMethodDef
 {
 public:
-	BfOperatorDeclaration* mOperatorDeclaration;	
+	BfOperatorDeclaration* mOperatorDeclaration;
 
 public:
 	BfOperatorDef()
@@ -996,7 +995,7 @@ public:
 struct BfTypeDefLookupContext
 {
 public:
-	int mBestPri;	
+	int mBestPri;
 	BfTypeDef* mBestTypeDef;
 	BfTypeDef* mAmbiguousTypeDef;
 
@@ -1005,8 +1004,8 @@ public:
 	{
 		mBestPri = (int)0x80000000;
 		mBestTypeDef = NULL;
-		mAmbiguousTypeDef = NULL;		
-	}	
+		mAmbiguousTypeDef = NULL;
+	}
 
 	bool HasValidMatch()
 	{
@@ -1036,12 +1035,12 @@ struct BfMemberSetEntry
 
 class BfTypeDefMemberSet : public HashSet<BfMemberSetEntry>
 {
-public:	
+public:
 	int mSourceSize;
 
 public:
 	BfTypeDefMemberSet()
-	{		
+	{
 		mSourceSize = 0;
 	}
 
@@ -1052,7 +1051,7 @@ public:
 	}
 };
 
-// For partial classes, the first entry in the map will contain the combined data 
+// For partial classes, the first entry in the map will contain the combined data
 class BfTypeDef
 {
 public:
@@ -1073,16 +1072,16 @@ public:
 
 public:
 	BfTypeDef* mNextRevision;
-	
+
 	BfSystem* mSystem;
 	BfProject* mProject;
 	BfTypeDeclaration* mTypeDeclaration;
-	BfSource* mSource;	
-	DefState mDefState;	
+	BfSource* mSource;
+	DefState mDefState;
 	Val128 mSignatureHash; // Data, methods, etc
-	Val128 mFullHash;	
+	Val128 mFullHash;
 	Val128 mInlineHash;
-	
+
 	BfTypeDef* mEmitParent;
 	BfTypeDef* mOuterType;
 	BfAtomComposite mNamespace;
@@ -1101,13 +1100,13 @@ public:
 	BfTypeDefMemberSet mFieldSet;
 	BfTypeDefMemberSet mPropertySet;
 	Array<BfOperatorDef*> mOperators;
-	Array<BfGenericParamDef*> mGenericParamDefs;	
+	Array<BfGenericParamDef*> mGenericParamDefs;
 	Array<BfExternalConstraintDef> mExternalConstraints;
-	Array<BfTypeReference*> mBaseTypes;	
-	Array<BfTypeDef*> mNestedTypes;		
+	Array<BfTypeReference*> mBaseTypes;
+	Array<BfTypeDef*> mNestedTypes;
 	Array<BfDirectStrTypeReference*> mDirectAllocNodes;
-	Array<BfTypeDef*> mPartials; // Only valid for mIsCombinedPartial		
-		
+	Array<BfTypeDef*> mPartials; // Only valid for mIsCombinedPartial
+
 	int mHash;
 	int mPartialIdx;
 	int mNestDepth;
@@ -1123,29 +1122,29 @@ public:
 	bool mIsDelegate;
 	bool mIsFunction;
 	bool mIsClosure;
-	bool mIsAbstract;	
-	bool mIsStatic;	
+	bool mIsAbstract;
+	bool mIsStatic;
 	bool mHasCEOnCompile;
 	bool mHasAppendCtor;
 	bool mHasCtorNoBody;
 	bool mHasExtensionMethods;
-	bool mHasOverrideMethods;	
+	bool mHasOverrideMethods;
 	bool mHasUsingFields;
 	bool mIsOpaque;
 	bool mIsNextRevision;
-	bool mInDeleteQueue;	
+	bool mInDeleteQueue;
 	bool mForceUseNextRevision;
 
 public:
 	BfTypeDef()
-	{		
+	{
 		Init();
 	}
 
 	~BfTypeDef();
 
 	void Init()
-	{		
+	{
 		mName = NULL;
 		mNameEx = NULL;
 		mSystem = NULL;
@@ -1158,11 +1157,11 @@ public:
 		mIsPartial = false;
 		mIsCombinedPartial = false;
 		mTypeDeclaration = NULL;
-		mSource = NULL;		
+		mSource = NULL;
 		mDefState = DefState_New;
-		mHash = 0;		
+		mHash = 0;
 		mPartialIdx = -1;
-		mIsAbstract = false;		
+		mIsAbstract = false;
 		mIsDelegate = false;
 		mIsFunction = false;
 		mIsClosure = false;
@@ -1176,29 +1175,29 @@ public:
 		mIsOpaque = false;
 		mPartialUsed = false;
 		mIsNextRevision = false;
-		mInDeleteQueue = false;		
+		mInDeleteQueue = false;
 		mForceUseNextRevision = false;
 		mDupDetectedRevision = -1;
 		mNestDepth = 0;
 		mEmitParent = NULL;
 		mOuterType = NULL;
-		mTypeDeclaration = NULL;		
+		mTypeDeclaration = NULL;
 		mNextRevision = NULL;
-		mProtection = BfProtection_Public;		
+		mProtection = BfProtection_Public;
 	}
 
 	BfSource* GetLastSource();
-	bool IsGlobalsContainer();	
+	bool IsGlobalsContainer();
 	void Reset();
 	void FreeMembers();
 	void PopulateMemberSets();
 	void ClearMemberSets();
-	void RemoveGenericParamDef(BfGenericParamDef* genericParamDef);	
+	void RemoveGenericParamDef(BfGenericParamDef* genericParamDef);
 	int GetSelfGenericParamCount();
 	String ToString();
 	BfMethodDef* GetMethodByName(const StringImpl& name, int paramCount = -1);
 	BfFieldDef* GetFieldByName(const StringImpl& name);
-	bool HasAutoProperty(BfPropertyDeclaration* propertyDeclaration);	
+	bool HasAutoProperty(BfPropertyDeclaration* propertyDeclaration);
 	bool ContainsPartial(BfTypeDef* partialTypeDef);
 	bool HasParsingFailed();
 	String GetAutoPropertyName(BfPropertyDeclaration* propertyDeclaration);
@@ -1274,7 +1273,7 @@ public:
 		SkipEntry()
 		{
 			mIndex = -1;
-			mRevision = -1;			
+			mRevision = -1;
 		}
 
 		SkipEntry(int index, int revision)
@@ -1337,12 +1336,12 @@ public:
 enum BfTargetType
 {
 	BfTargetType_BeefConsoleApplication,
-	BfTargetType_BeefWindowsApplication,		
-	BfTargetType_BeefLib,	
+	BfTargetType_BeefWindowsApplication,
+	BfTargetType_BeefLib,
 	BfTargetType_CustomBuild,
 	BfTargetType_BeefTest,
 	BfTargetType_C_ConsoleApplication,
-	BfTargetType_C_WindowsApplication,	
+	BfTargetType_C_WindowsApplication,
 	BfTargetType_BeefApplication_StaticLib,
 	BfTargetType_BeefApplication_DynamicLib,
 	BfTargetType_BeefLib_StaticLib,
@@ -1372,14 +1371,14 @@ public:
 		DeleteStage_AwaitingRefs,
 	};
 
-public:	
+public:
 	BfSystem* mSystem;
 	String mName;
 	String mSafeName;
 	String mDirectory;
 	Array<BfProject*> mDependencies;
 	BfTargetType mTargetType;
-	BfCodeGenOptions mCodeGenOptions;	
+	BfCodeGenOptions mCodeGenOptions;
 	bool mDisabled;
 	bool mSingleModule;
 	bool mAlwaysIncludeAll;
@@ -1387,11 +1386,11 @@ public:
 	int mIdx;
 
 	String mStartupObject;
-	Array<String> mPreprocessorMacros;	
+	Array<String> mPreprocessorMacros;
 	Dictionary<BfAtomComposite, int> mNamespaces;
-	
+
 	HashSet<BfModule*> mUsedModules;
-	HashSet<BfType*> mReferencedTypeData;	
+	HashSet<BfType*> mReferencedTypeData;
 
 	Val128 mBuildConfigHash;
 	Val128 mVDataConfigHash;
@@ -1403,7 +1402,7 @@ public:
 	~BfProject();
 
 	bool ContainsReference(BfProject* refProject);
-	bool ReferencesOrReferencedBy(BfProject* refProject);	
+	bool ReferencesOrReferencedBy(BfProject* refProject);
 	bool IsTestProject();
 };
 
@@ -1415,7 +1414,7 @@ enum BfWarning
 	BfWarning_CS0162_UnreachableCode					= 162,
 	BfWarning_CS0168_VariableDeclaredButNeverUsed		= 168,
 	BfWarning_CS0472_ValueTypeNullCompare				= 472,
-	BfWarning_CS1030_PragmaWarning						= 1030,	
+	BfWarning_CS1030_PragmaWarning						= 1030,
 	BfWarning_BF4201_Only7Hex							= 4201,
 	BfWarning_BF4202_TooManyHexForInt					= 4202,
 	BfWarning_BF4203_UnnecessaryDynamicCast				= 4203,
@@ -1438,9 +1437,9 @@ class BfErrorBase
 public:
 	bool mIsWarning;
 	bool mIsDeferred;
-	BfSourceData* mSource;	
+	BfSourceData* mSource;
 	int mSrcStart;
-	int mSrcEnd;	
+	int mSrcEnd;
 	BfErrorLocation* mLocation;
 
 public:
@@ -1448,7 +1447,7 @@ public:
 	{
 		mIsWarning = false;
 		mIsDeferred = false;
-		mSource = NULL;		
+		mSource = NULL;
 		mSrcStart = -1;
 		mSrcEnd = -1;
 		mLocation = NULL;
@@ -1466,11 +1465,11 @@ public:
 
 class BfError : public BfErrorBase
 {
-public:	
-	bool mIsAfter;	
+public:
+	bool mIsAfter;
 	bool mIsPersistent;
 	BfWhileSpecializingFlags mIsWhileSpecializing;
-	bool mIgnore;	
+	bool mIgnore;
 	BfProject* mProject;
 	String mError;
 	int mWarningNumber;
@@ -1479,10 +1478,10 @@ public:
 public:
 	BfError()
 	{
-		mIsAfter = false;		
+		mIsAfter = false;
 		mIsPersistent = false;
 		mIsWhileSpecializing = BfWhileSpecializingFlag_None;
-		mIgnore = false;		
+		mIgnore = false;
 		mProject = NULL;
 		mWarningNumber = 0;
 	}
@@ -1540,16 +1539,16 @@ public:
 	BfSystem* mSystem;
 	BfCompiler* mCompiler;
 	bool mTrimMessagesToCursor;
-	int mFailedIdx;	
+	int mFailedIdx;
 	int mWarnIdx;
-	
+
 	Dictionary<BfSourceData*, String> mSourceFileNameMap;
 	HashSet<BfErrorEntry> mErrorSet;
 	Array<BfError*> mErrors;
 	int mIgnoreCount;
-	int mWarningCount;	
+	int mWarningCount;
 	int mDeferredErrorCount;
-	Deque<String> mOutStream;	
+	Deque<String> mOutStream;
 	bool mLastWasDisplayed;
 	bool mLastWasAdded;
 	uint8 mClassifierPassId;
@@ -1567,9 +1566,9 @@ public:
 		mLastWasDisplayed = false;
 		mLastWasAdded = false;
 		mClassifierPassId = 0;
-		mWarningCount = 0;		
+		mWarningCount = 0;
 		mDeferredErrorCount = 0;
-		mIgnoreCount = 0;		
+		mIgnoreCount = 0;
 		mHadSignatureChanges = false;
 	}
 
@@ -1594,7 +1593,7 @@ public:
 	BfError* Warn(int warningNumber, const StringImpl& warning, BfAstNode* refNode, bool isDeferred = false);
 	BfError* DeferWarn(int warningNumber, const StringImpl& warning, BfAstNode* refNode);
 	BfError* WarnAfter(int warningNumber, const StringImpl& warning, BfAstNode* refNode);
-	BfError* WarnAfterAt(int warningNumber, const StringImpl& error, BfSourceData* bfSource, int srcIdx);	
+	BfError* WarnAfterAt(int warningNumber, const StringImpl& error, BfSourceData* bfSource, int srcIdx);
 
 	BfMoreInfo* MoreInfoAt(const StringImpl& info, BfSourceData* bfSource, int srcIdx, int srcLen, BfFailFlags flags = BfFailFlag_None);
 	BfMoreInfo* MoreInfo(const StringImpl& info, bool forceQueue = false);
@@ -1608,7 +1607,7 @@ public:
 	BfError* FailAfter(const StringImpl& error, BfAstNode* refNode);
 	BfError* DeferFail(const StringImpl& error, BfAstNode* refNode);
 	void SilentFail();
-	
+
 	void TryFlushDeferredError();
 	void WriteErrorSummary();
 };
@@ -1635,7 +1634,6 @@ enum BfOptionFlags
 
 	BfOptionFlags_Reflect_MethodMask		= BfOptionFlags_ReflectStaticMethods | BfOptionFlags_ReflectNonStaticMethods | BfOptionFlags_ReflectConstructors,
 	BfOptionFlags_Mask = 0x3FFF
-
 };
 
 enum BfFieldFlags
@@ -1661,7 +1659,7 @@ enum BfReflectKind
 	BfReflectKind_DefaultConstructor = 8,
 	BfReflectKind_Constructors = 0x10,
 	BfReflectKind_StaticMethods = 0x20,
-	BfReflectKind_Methods = 0x40,	
+	BfReflectKind_Methods = 0x40,
 	BfReflectKind_DynamicBoxing = 0x80,
 	BfReflectKind_User = 0x100,
 	BfReflectKind_All = 0x1FF,
@@ -1682,15 +1680,15 @@ public:
 public:
 	Array<String> mTypeFilters;
 	Array<String> mAttributeFilters;
-	Array<int> mMatchedIndices;	
+	Array<int> mMatchedIndices;
 	int mSIMDSetting;
 	int mOptimizationLevel;
-	int mEmitDebugInfo;	
+	int mEmitDebugInfo;
 	BfOptionFlags mAndFlags;
 	BfOptionFlags mOrFlags;
 	Array<MethodFilter> mReflectMethodFilters;
 	Array<MethodFilter> mReflectMethodAttributeFilters;
-	int mAllocStackTraceDepth;	
+	int mAllocStackTraceDepth;
 
 public:
 	static int Apply(int val, int applyVal)
@@ -1698,7 +1696,7 @@ public:
 		if (applyVal != -1)
 			return applyVal;
 		return val;
-	}	
+	}
 
 	bool Apply(bool val, BfOptionFlags flags)
 	{
@@ -1722,10 +1720,10 @@ enum BfFindTypeDefFlags
 
 class BfSystem
 {
-public:			
-	int mPtrSize;				
+public:
+	int mPtrSize;
 	bool mIsResolveOnly;
-	
+
 	CritSect mDataLock; // short-lived, hold only while active modifying data
 	// The following are protected by mDataLock:
 	HashSet<String> mUsedSafeProjectNames;
@@ -1753,11 +1751,11 @@ public:
 	uint32 mYieldTickCount;
 	int mHighestYieldTime;
 	// The following are protected by mSystemLock - can only be accessed by the compiling thread
-	Dictionary<String, BfTypeDef*> mSystemTypeDefs;	
-	BfTypeDefMap mTypeDefs;		
+	Dictionary<String, BfTypeDef*> mSystemTypeDefs;
+	BfTypeDefMap mTypeDefs;
 	bool mNeedsTypesHandledByCompiler;
-	BumpAllocator mAlloc;	
-	int mAtomCreateIdx;	
+	BumpAllocator mAlloc;
+	int mAtomCreateIdx;
 	Dictionary<StringView, BfAtom*> mAtomMap;
 	Array<BfAtom*> mAtomGraveyard;
 	uint32 mAtomUpdateIdx;
@@ -1792,7 +1790,7 @@ public:
 	BfTypeDef* mTypeChar16;
 	BfTypeDef* mTypeChar32;
 	BfTypeDef* mTypeSingle;
-	BfTypeDef* mTypeDouble;	
+	BfTypeDef* mTypeDouble;
 
 	BfDirectStrTypeReference* mDirectVoidTypeRef;
 	BfDirectStrTypeReference* mDirectBoolTypeRef;
@@ -1808,58 +1806,57 @@ public:
 public:
 	BfSystem();
 	~BfSystem();
-	
+
 	BfAtom* GetAtom(const StringImpl& string);
 	BfAtom* FindAtom(const StringImpl& string); // Doesn't create a ref
 	BfAtom* FindAtom(const StringView& string); // Doesn't create a ref
-	void ReleaseAtom(BfAtom* atom);	
+	void ReleaseAtom(BfAtom* atom);
 	void ProcessAtomGraveyard();
 	void RefAtomComposite(const BfAtomComposite& atomComposite);
-	void ReleaseAtomComposite(const BfAtomComposite& atomComposite);	
+	void ReleaseAtomComposite(const BfAtomComposite& atomComposite);
 	void SanityCheckAtomComposite(const BfAtomComposite& atomComposite);
 	void TrackName(BfTypeDef* typeDef);
-	void UntrackName(BfTypeDef* typeDef);	
+	void UntrackName(BfTypeDef* typeDef);
 
 	bool ParseAtomComposite(const StringView& name, BfAtomComposite& composite, bool addRefs = false);
 
-	void CreateBasicTypes();	
+	void CreateBasicTypes();
 	bool DoesLiteralFit(BfTypeCode typeCode, int64 value);
 	bool DoesLiteralFit(BfTypeCode typeCode, uint64 value);
 	bool DoesLiteralFit(BfTypeCode typeCode, const BfVariant& variant);
-	BfParser* CreateParser(BfProject* bfProject);	
-	BfCompiler* CreateCompiler(bool isResolveOnly);			
+	BfParser* CreateParser(BfProject* bfProject);
+	BfCompiler* CreateCompiler(bool isResolveOnly);
 	BfProject* GetProject(const StringImpl& projName);
 
-	BfTypeReference* GetTypeRefElement(BfTypeReference* typeRef);	
+	BfTypeReference* GetTypeRefElement(BfTypeReference* typeRef);
 	BfTypeDef* FilterDeletedTypeDef(BfTypeDef* typeDef);
-	bool CheckTypeDefReference(BfTypeDef* typeDef, BfProject* project);	
+	bool CheckTypeDefReference(BfTypeDef* typeDef, BfProject* project);
 	BfTypeDef* FindTypeDef(const BfAtomComposite& findName, int numGenericArgs = 0, BfProject* project = NULL, const Array<BfAtomComposite>& namespaceSearch = Array<BfAtomComposite>(), BfTypeDef** ambiguousTypeDef = NULL, BfFindTypeDefFlags flags = BfFindTypeDefFlag_None);
 	bool FindTypeDef(const BfAtomComposite& findName, int numGenericArgs, BfProject* project, const BfAtomComposite& checkNamespace, bool allowPrivate, BfTypeDefLookupContext* ctx);
 	BfTypeDef* FindTypeDef(const StringImpl& typeName, int numGenericArgs = 0, BfProject* project = NULL, const Array<BfAtomComposite>& namespaceSearch = Array<BfAtomComposite>(), BfTypeDef** ambiguousTypeDef = NULL, BfFindTypeDefFlags flags = BfFindTypeDefFlag_None);
 	BfTypeDef* FindTypeDef(const StringImpl& typeName, BfProject* project);
 	BfTypeDef* FindTypeDefEx(const StringImpl& typeName);
 	void ClearTypeDefCache();
-	void FindFixitNamespaces(const StringImpl& typeName, int numGenericArgs, BfProject* project, std::set<String>& fixitNamespaces);		
+	void FindFixitNamespaces(const StringImpl& typeName, int numGenericArgs, BfProject* project, std::set<String>& fixitNamespaces);
 
 	void RemoveTypeDef(BfTypeDef* typeDef);
 	//BfTypeDefMap::Iterator RemoveTypeDef(BfTypeDefMap::Iterator typeDefItr);
 	void AddNamespaceUsage(const BfAtomComposite& namespaceStr, BfProject* bfProject);
 	void RemoveNamespaceUsage(const BfAtomComposite& namespaceStr, BfProject* bfProject);
-	bool ContainsNamespace(const BfAtomComposite& namespaceStr, BfProject* bfProject);	
+	bool ContainsNamespace(const BfAtomComposite& namespaceStr, BfProject* bfProject);
 	void InjectNewRevision(BfTypeDef* typeDef);
 	void AddToCompositePartial(BfPassInstance* passInstance, BfTypeDef* compositeTypeDef, BfTypeDef* partialTypeDef);
-	void FinishCompositePartial(BfTypeDef* compositeTypeDef);	
+	void FinishCompositePartial(BfTypeDef* compositeTypeDef);
 	void CopyTypeDef(BfTypeDef* typeDef, BfTypeDef* nextTypeDef);
 	void UpdateEmittedTypeDef(BfTypeDef* typeDef);
 
 	BfTypeDef* GetCombinedPartial(BfTypeDef* typeDef);
 	BfTypeDef* GetOuterTypeNonPartial(BfTypeDef* typeDef);
-	
 
 	int GetGenericParamIdx(const Array<BfGenericParamDef*>& genericParams, const StringImpl& name);
 	int GetGenericParamIdx(const Array<BfGenericParamDef*>& genericParams, BfTypeReference* typeRef);
 
-	void StartYieldSection();	
+	void StartYieldSection();
 	void CheckLockYield(); // Yields to a higher priority request
 	void SummarizeYieldSection();
 
@@ -1888,7 +1885,7 @@ public:
 
 public:
 	AutoDisallowYield(BfSystem* system)
-	{ 		
+	{
 		mSystem = system;
 		mSystem->mYieldDisallowCount++;
 		mHeld = true;
@@ -1921,7 +1918,6 @@ public:
 	}
 };
 
-
 #ifdef _DEBUG
 
 #ifdef BF_PLATFORM_WINDOWS
@@ -1959,7 +1955,6 @@ public:
 #define BfLogX(logIdx, fmt, ...) {} // Nothing
 #endif
 
-
 #ifdef BF_WANTS_LOG_SYS
 #define BfLogSys(sys, fmt, ...) DoBfLog((sys)->mIsResolveOnly ? 1 : 2, fmt, ##__VA_ARGS__)
 #define BfLogSysM(fmt, ...) DoBfLog(mSystem->mIsResolveOnly ? 1 : 2, fmt, ##__VA_ARGS__)
@@ -2035,7 +2030,6 @@ namespace std
 	};
 }
 
-
 namespace std
 {
 	template<>

+ 1 - 1
IDEHelper/Compiler/BfTargetTriple.cpp

@@ -39,4 +39,4 @@ BfMachineType BfTargetTriple::GetMachineType()
 	if (!mParsed)
 		Parse();
 	return mMachineType;
-}
+}

+ 0 - 1
IDEHelper/Compiler/BfType.h

@@ -3,5 +3,4 @@
 
 NS_BF_BEGIN
 
-
 NS_BF_END

+ 2 - 2
IDEHelper/Compiler/BfUtil.cpp

@@ -60,7 +60,7 @@ String Beefy::EncodeFileName(const StringImpl& fromStr)
 		path.Insert(0, fromStr.mPtr, 80);
 	else
 		path += fromStr;
-	
+
 	path.Replace("$", "\\");
 	for (auto& c : path)
 	{
@@ -178,7 +178,7 @@ bool Beefy::BfCheckWildcard(const StringImpl& wildcard, const StringImpl& checkS
 				break;
 		}
 
-		prevFilterC = filterC;		
+		prevFilterC = filterC;
 	}
 
 	return matched;

+ 12 - 13
IDEHelper/Compiler/BfUtil.h

@@ -41,7 +41,7 @@ public:
 public:
 	SetAndRestoreValue()
 	{
-		mVarPtr = NULL;		
+		mVarPtr = NULL;
 	}
 
 	SetAndRestoreValue(T& varRef)
@@ -54,14 +54,14 @@ public:
 	SetAndRestoreValue(T& varRef, T newVal)
 	{
 		mPrevVal = varRef;
-		mVarPtr = &varRef;		
+		mVarPtr = &varRef;
 		varRef = newVal;
 		mNewVal = newVal;
 	}
 
 	SetAndRestoreValue(T& varRef, T newVal, bool doSet)
 	{
-		mPrevVal = varRef;		
+		mPrevVal = varRef;
 		mVarPtr = &varRef;
 		if (doSet)
 			varRef = newVal;
@@ -183,14 +183,14 @@ public:
 				mVals.pop_back();
 				return val;
 			}
-			
+
 			if (mZeroAlloc)
 			{
 				void* addr = malloc(sizeof(T));
 				memset(addr, 0, sizeof(T));
 				val = new(addr) T();
 			}
-			else 			
+			else
 				val = new T();
 			if (mOwnsAll)
 				mVals.push_back(val);
@@ -226,15 +226,15 @@ inline void EncodeSLEB128(uint8*& buf, int value)
 	bool hasMore;
 	do
 	{
-		uint8 curByte = (uint8)(value & 0x7f);    
+		uint8 curByte = (uint8)(value & 0x7f);
 		value >>= 7;
 		hasMore = !((((value == 0) && ((curByte & 0x40) == 0)) ||
 			((value == -1) && ((curByte & 0x40) != 0))));
 		if (hasMore)
 			curByte |= 0x80;
-		*(buf++) = curByte;                
+		*(buf++) = curByte;
 	}
-	while (hasMore);        
+	while (hasMore);
 }
 
 inline void EncodeSLEB128(uint8*& buf, int64_t value)
@@ -242,15 +242,15 @@ inline void EncodeSLEB128(uint8*& buf, int64_t value)
 	bool hasMore;
 	do
 	{
-		uint8 curByte = (uint8)(value & 0x7f);    
+		uint8 curByte = (uint8)(value & 0x7f);
 		value >>= 7;
 		hasMore = !((((value == 0) && ((curByte & 0x40) == 0)) ||
 			((value == -1) && ((curByte & 0x40) != 0))));
 		if (hasMore)
 			curByte |= 0x80;
-		*(buf++) = curByte;                
+		*(buf++) = curByte;
 	}
-	while (hasMore);        
+	while (hasMore);
 }
 
 #pragma warning(push)
@@ -258,7 +258,7 @@ inline void EncodeSLEB128(uint8*& buf, int64_t value)
 
 /// Utility function to decode a SLEB128 value.
 inline int64_t DecodeSLEB128(const uint8*& p)
-{	
+{
 	int value = 0;
 	int shift = 0;
 	int curByte;
@@ -267,7 +267,6 @@ inline int64_t DecodeSLEB128(const uint8*& p)
 		curByte = (uint8_t)*p++;
 		value |= ((curByte & 0x7f) << shift);
 		shift += 7;
-
 	} while (curByte >= 128);
 	// Sign extend negative numbers.
 	if (((curByte & 0x40) != 0) && (shift < 64))

+ 1 - 1
IDEHelper/Compiler/BfVarDeclChecker.cpp

@@ -10,4 +10,4 @@ BfVarDeclChecker::BfVarDeclChecker()
 void BfVarDeclChecker::Visit(BfVariableDeclaration * binOpExpr)
 {
 	mHasVarDecl = true;
-}
+}

+ 0 - 1
IDEHelper/Compiler/BfVarDeclChecker.h

@@ -17,5 +17,4 @@ public:
 	virtual void Visit(BfVariableDeclaration* binOpExpr) override;
 };
 
-
 NS_BF_END

File diff ditekan karena terlalu besar
+ 132 - 139
IDEHelper/Compiler/CeDebugger.cpp


+ 15 - 15
IDEHelper/Compiler/CeDebugger.h

@@ -29,7 +29,7 @@ public:
 
 class CeBreakpoint : public Breakpoint
 {
-public:		
+public:
 	uintptr mCurBindAddr;
 	bool mHasBound;
 	int mIdx;
@@ -37,7 +37,7 @@ public:
 
 public:
 	CeBreakpoint()
-	{				
+	{
 		mCurBindAddr = 1;
 		mHasBound = false;
 		mIdx = -1;
@@ -62,7 +62,7 @@ struct CeFormatInfo
 	intptr mArrayLength;
 	intptr mOverrideCount;
 	intptr mMaxCount;
-	DwDisplayType mDisplayType;	
+	DwDisplayType mDisplayType;
 	int mTotalSummaryLength;
 	String mReferenceId;
 	String mSubjectExpr;
@@ -86,7 +86,7 @@ struct CeFormatInfo
 		mMaxCount = -1;
 		mTotalSummaryLength = 0;
 		mDisplayType = DwDisplayType_NotSpecified;
-		mExpandItemDepth = 0;		
+		mExpandItemDepth = 0;
 	}
 };
 
@@ -99,7 +99,7 @@ public:
 	BfPassInstance* mPassInstance;
 	BfExprEvaluator* mExprEvaluator;
 	BfExpression* mExprNode;
-	BfTypedValue mResultOverride;	
+	BfTypedValue mResultOverride;
 	String mExprString;
 
 	BfTypedValue mExplicitThis;
@@ -110,7 +110,7 @@ public:
 	void Init(CeDebugger* winDebugger, const StringImpl& expr, CeFormatInfo* formatInfo = NULL, BfTypedValue contextValue = BfTypedValue());
 	bool HasExpression();
 	~CeEvaluationContext();
-	BfTypedValue EvaluateInContext(BfTypedValue contextTypedValue, CeDbgState* dbgState = NULL);	
+	BfTypedValue EvaluateInContext(BfTypedValue contextTypedValue, CeDbgState* dbgState = NULL);
 	String GetErrorStr();
 	bool HadError();
 };
@@ -153,9 +153,9 @@ public:
 	BfAstNode* mExprNode;
 	String mReferenceId;
 	int mCallStackIdx;
-	String mResult;	
+	String mResult;
 	int mIdleTicks;
-	String mException;	
+	String mException;
 	bool mDone;
 
 	CePendingExpr();
@@ -197,7 +197,7 @@ public:
 	{
 	public:
 		int mFieldIdx;
-		int64 mVal;		
+		int64 mVal;
 	};
 
 public:
@@ -243,16 +243,16 @@ public:
 	CeMachine* mCeMachine;
 	DebugManager* mDebugManager;
 	CePendingExpr* mDebugPendingExpr;
-	CeDbgState* mCurDbgState;	
+	CeDbgState* mCurDbgState;
 	Array<CeBreakpoint*> mBreakpoints;
-	Dictionary<String, CeFileInfo*> mFileInfo;	
+	Dictionary<String, CeFileInfo*> mFileInfo;
 	Dictionary<int, CeDbgTypeInfo> mDbgTypeInfoMap;
 	Array<CeDbgStackInfo> mDbgCallStack;
 
 	CeEvaluationContext* mCurEvaluationContext;
 	CeBreakpoint* mActiveBreakpoint;
 	int mBreakpointVersion;
-	bool mBreakpointCacheDirty;	
+	bool mBreakpointCacheDirty;
 	bool mBreakpointFramesDirty;
 	int mCurDisasmFuncId;
 	int mPendingActiveFrameOffset;
@@ -270,7 +270,7 @@ public:
 
 	bool CheckConditionalBreakpoint(CeBreakpoint* breakpoint);
 	bool SetupStep(int frameIdx = 0);
-	CeFrame* GetFrame(int callStackIdx);	
+	CeFrame* GetFrame(int callStackIdx);
 	String DoEvaluate(CePendingExpr* pendingExpr, bool inCompilerThread);
 	String Evaluate(const StringImpl& expr, CeFormatInfo formatInfo, int callStackIdx, int cursorPos, int language, DwEvalExpressionFlags expressionFlags);
 	DwDisplayInfo* GetDisplayInfo(const StringImpl& referenceId);
@@ -296,7 +296,7 @@ public:
 	void UpdateBreakpointCache();
 	void UpdateBreakpointFrames();
 	void UpdateBreakpointAddrs();
-	void UpdateBreakpoints(CeFunction* ceFunction);	
+	void UpdateBreakpoints(CeFunction* ceFunction);
 	void Continue();
 	CeDbgTypeInfo* GetDbgTypeInfo(int typeId);
 	CeDbgTypeInfo* GetDbgTypeInfo(BfIRType irType);
@@ -346,7 +346,7 @@ public:
 	virtual void StepIntoSpecific(intptr addr) override;
 	virtual void StepOver(bool inAssembly) override;
 	virtual void StepOut(bool inAssembly) override;
-	virtual void SetNextStatement(bool inAssembly, const StringImpl& fileName, int64 lineNumOrAsmAddr, int wantColumn) override;	
+	virtual void SetNextStatement(bool inAssembly, const StringImpl& fileName, int64 lineNumOrAsmAddr, int wantColumn) override;
 	//virtual DbgTypedValue GetRegister(const StringImpl& regName, CPURegisters* registers, Array<RegForm>* regForms = NULL) override;
 	virtual String Evaluate(const StringImpl& expr, int callStackIdx, int cursorPos, int language, DwEvalExpressionFlags expressionFlags) override;
 	virtual String EvaluateContinue() override;

File diff ditekan karena terlalu besar
+ 141 - 142
IDEHelper/Compiler/CeMachine.cpp


+ 72 - 72
IDEHelper/Compiler/CeMachine.h

@@ -80,17 +80,17 @@ enum CeOp : int16
 	CeOp_JmpIf,
 	CeOp_JmpIfNot,
 
-	CeOp_Error,	
+	CeOp_Error,
 	CeOp_DynamicCastCheck,
 	CeOp_GetReflectType,
 	CeOp_GetString,
 	CeOp_Malloc,
 	CeOp_Free,
-	
+
 	CeOp_MemSet,
 	CeOp_MemSet_Const,
 	CeOp_MemCpy,
-	
+
 	CeOp_FrameAddr_32,
 	CeOp_FrameAddr_64,
 	CeOp_FrameAddrOfs_32,
@@ -116,7 +116,7 @@ enum CeOp : int16
 	CeOp_GetMethod_Virt,
 	CeOp_GetMethod_IFace,
 	CeOp_Call,
-	
+
 	CeOp_Conv_I8_I16,
 	CeOp_Conv_I8_I32,
 	CeOp_Conv_I8_I64,
@@ -128,7 +128,7 @@ enum CeOp : int16
 	CeOp_Conv_I16_F64,
 	CeOp_Conv_I32_I64,
 	CeOp_Conv_I32_F32,
-	CeOp_Conv_I32_F64,	
+	CeOp_Conv_I32_F64,
 	CeOp_Conv_I64_F32,
 	CeOp_Conv_I64_F64,
 	CeOp_Conv_U8_U16,
@@ -168,7 +168,7 @@ enum CeOp : int16
 	CEOP_SIZED_NUMERIC_PLUSF(AddConst),
 	CEOP_SIZED_NUMERIC_PLUSF(Add),
 	CEOP_SIZED_NUMERIC_PLUSF(Sub),
-	CEOP_SIZED_NUMERIC_PLUSF(Mul),	
+	CEOP_SIZED_NUMERIC_PLUSF(Mul),
 	CEOP_SIZED_NUMERIC_PLUSF(Div),
 	CEOP_SIZED_UNUMERIC(Div),
 	CEOP_SIZED_NUMERIC_PLUSF(Mod),
@@ -179,7 +179,7 @@ enum CeOp : int16
 	CEOP_SIZED_NUMERIC(Shl),
 	CEOP_SIZED_NUMERIC(Shr),
 	CEOP_SIZED_UNUMERIC(Shr),
-	
+
 	CEOP_SIZED_FLOAT(Acos),
 	CEOP_SIZED_FLOAT(Asin),
 	CEOP_SIZED_FLOAT(Atan),
@@ -190,7 +190,7 @@ enum CeOp : int16
 	CEOP_SIZED_FLOAT(Exp),
 	CEOP_SIZED_FLOAT(Floor),
 	CEOP_SIZED_FLOAT(Log),
-	CEOP_SIZED_FLOAT(Log10),	
+	CEOP_SIZED_FLOAT(Log10),
 	CEOP_SIZED_FLOAT(Pow),
 	CEOP_SIZED_FLOAT(Round),
 	CEOP_SIZED_FLOAT(Sin),
@@ -198,7 +198,7 @@ enum CeOp : int16
 	CEOP_SIZED_FLOAT(Sqrt),
 	CEOP_SIZED_FLOAT(Tan),
 	CEOP_SIZED_FLOAT(Tanh),
-	
+
 	CEOP_SIZED_NUMERIC_PLUSF(Cmp_EQ),
 	CEOP_SIZED_NUMERIC_PLUSF(Cmp_NE),
 	CEOP_SIZED_NUMERIC_PLUSF(Cmp_SLT),
@@ -307,7 +307,7 @@ public:
 };
 
 struct CeDbgInlineEntry
-{	
+{
 	int mScope;
 	int mLine;
 	int mColumn;
@@ -329,7 +329,7 @@ public:
 		mCeFunction = NULL;
 		mRefCount = 0;
 	}
-	
+
 	~CeFunctionInfo();
 
 	BfTypeInstance* GetOwner()
@@ -447,14 +447,14 @@ enum CeFunctionKind
 	CeFunctionKind_Method_GetInfo,
 	CeFunctionKind_Method_GetParamInfo,
 	CeFunctionKind_Method_GetGenericArg,
-	
+
 	CeFunctionKind_SetReturnType,
 	CeFunctionKind_EmitTypeBody,
 	CeFunctionKind_EmitAddInterface,
 	CeFunctionKind_EmitMethodEntry,
 	CeFunctionKind_EmitMethodExit,
 	CeFunctionKind_EmitMixin,
-	
+
 	CeFunctionKind_BfpDirectory_Create,
 	CeFunctionKind_BfpDirectory_Rename,
 	CeFunctionKind_BfpDirectory_Delete,
@@ -483,7 +483,7 @@ enum CeFunctionKind
 	CeFunctionKind_BfpFile_GetTempFileName,
 	CeFunctionKind_BfpFile_GetFullPath,
 	CeFunctionKind_BfpFile_GetActualPath,
-	
+
 	CeFunctionKind_BfpFindFileData_FindFirstFile,
 	CeFunctionKind_BfpFindFileData_FindNextFile,
 	CeFunctionKind_BfpFindFileData_GetFileName,
@@ -521,7 +521,7 @@ enum CeFunctionKind
 	CeFunctionKind_Math_Asin,
 	CeFunctionKind_Math_Atan,
 	CeFunctionKind_Math_Atan2,
-	CeFunctionKind_Math_Ceiling,	
+	CeFunctionKind_Math_Ceiling,
 	CeFunctionKind_Math_Cos,
 	CeFunctionKind_Math_Cosh,
 	CeFunctionKind_Math_Exp,
@@ -535,7 +535,7 @@ enum CeFunctionKind
 	CeFunctionKind_Math_Sinh,
 	CeFunctionKind_Math_Sqrt,
 	CeFunctionKind_Math_Tan,
-	CeFunctionKind_Math_Tanh,	
+	CeFunctionKind_Math_Tanh,
 };
 
 class CeConstStructFixup
@@ -596,14 +596,14 @@ public:
 	{
 		mTypeId = -1;
 		mSize = 0;
-		mAddr = 0;		
-		mBindExecuteId = -1;		
+		mAddr = 0;
+		mBindExecuteId = -1;
 	}
 };
 
 class CeDbgVariable
 {
-public:	
+public:
 	String mName;
 	CeOperand mValue;
 	BfType* mType;
@@ -641,17 +641,17 @@ public:
 	CeMachine* mCeMachine;
 	CeFunctionInfo* mCeFunctionInfo;
 	CeInnerFunctionInfo* mCeInnerFunctionInfo;
-	BfMethodInstance* mMethodInstance;	
-	CeFunctionKind mFunctionKind;	
+	BfMethodInstance* mMethodInstance;
+	CeFunctionKind mFunctionKind;
 	InitializeState mInitializeState;
 	bool mFailed;
 	bool mIsVarReturn;
-	Array<uint8> mCode;	
+	Array<uint8> mCode;
 	Array<CeDbgScope> mDbgScopes;
 	Array<CeDbgInlineEntry> mDbgInlineTable;
 	Array<CeDbgMethodRef> mDbgMethodRefTable;
-	Array<CeEmitEntry> mEmitTable;	
-	Array<CeCallEntry> mCallTable;	
+	Array<CeEmitEntry> mEmitTable;
+	Array<CeCallEntry> mCallTable;
 	Array<CeStringEntry> mStringTable;
 	Array<CeConstStructData> mConstStructTable;
 	Array<CeStaticFieldEntry> mStaticFieldTable;
@@ -659,7 +659,7 @@ public:
 	Array<CeFunction*> mInnerFunctions;
 	Dictionary<int, CeBreakpointBind> mBreakpoints;
 	String mGenError;
-	int mFrameSize;	
+	int mFrameSize;
 	int mMaxReturnSize;
 	int mId;
 	int mBreakpointVersion;
@@ -671,7 +671,7 @@ public:
 		mCeMachine = NULL;
 		mCeFunctionInfo = NULL;
 		mCeInnerFunctionInfo = NULL;
-		mFunctionKind = CeFunctionKind_NotSet;		
+		mFunctionKind = CeFunctionKind_NotSet;
 		mInitializeState = InitializeState_None;
 		mMethodInstance = NULL;
 		mFailed = false;
@@ -681,7 +681,7 @@ public:
 		mBreakpointVersion = 0;
 		mId = -1;
 		mDbgInfo = NULL;
-	}	
+	}
 
 	~CeFunction();
 	void Print();
@@ -747,7 +747,7 @@ enum CeSizeClass
 
 class CeDumpContext
 {
-public:	
+public:
 	Dictionary<int, CeDbgVariable*> mVarMap;
 	CeFunction* mCeFunction;
 	String mStr;
@@ -765,13 +765,13 @@ public:
 	void DumpOperandInfo(CeOperandInfoKind operandInfoKind);
 
 	void Next();
-	void Dump();	
+	void Dump();
 };
 
 struct CePhiOutgoing
 {
 	BeValue* mPhiValue;
-	BePhiInst* mPhiInst;	
+	BePhiInst* mPhiInst;
 	int mPhiBlockIdx;
 };
 
@@ -784,7 +784,7 @@ public:
 public:
 	CeBlock()
 	{
-		mEmitOfs = -1;		
+		mEmitOfs = -1;
 	}
 };
 
@@ -811,7 +811,7 @@ struct CeDbgInlineLookup
 		mDbgFile = NULL;
 		mInlineAtIdx = -1;
 	}
-	
+
 	bool operator==(const CeDbgInlineLookup& second) const
 	{
 		return (mDbgFile == second.mDbgFile) && (mDbgFile == second.mDbgFile);
@@ -820,18 +820,18 @@ struct CeDbgInlineLookup
 
 class CeBuilder
 {
-public:	
+public:
 	CeBuilder* mParentBuilder;
-	CeMachine* mCeMachine;	
+	CeMachine* mCeMachine;
 	CeFunction* mCeFunction;
-	BeFunction* mBeFunction;	
+	BeFunction* mBeFunction;
 	CeOperand mReturnVal;
 	BeType* mIntPtrType;
-	int mPtrSize;	
+	int mPtrSize;
 
 	String mError;
 	BeDbgLoc* mCurDbgLoc;
-	Array<CeBlock> mBlocks;	
+	Array<CeBlock> mBlocks;
 	Array<CeJumpEntry> mJumpTable;
 	Dictionary<BeValue*, CeOperand> mValueToOperand;
 	int mFrameSize;
@@ -845,7 +845,7 @@ public:
 	Dictionary<BeGlobalVariable*, int> mStaticFieldMap;
 	Dictionary<String, BfFieldInstance*> mStaticFieldInstanceMap;
 	Dictionary<BeValue*, int> mDbgVariableMap;
-	
+
 public:
 	CeBuilder()
 	{
@@ -857,7 +857,7 @@ public:
 		mCurDbgLoc = NULL;
 		mFrameSize = 0;
 	}
-		
+
 	void Fail(const StringImpl& error);
 
 	CeOperand FrameAlloc(BeType* type);
@@ -871,7 +871,7 @@ public:
 	int GetCodePos();
 
 	void HandleParams();
-	
+
 	void Emit(uint8 val);
 	void Emit(CeOp val);
 	void EmitSizedOp(CeOp val, int size);
@@ -881,7 +881,7 @@ public:
 	void Emit(void* ptr, int size);
 	void EmitZeroes(int size);
 	void EmitJump(CeOp op, const CeOperand& block);
-	void EmitBinarySwitchSection(BeSwitchInst* switchInst, int startIdx, int endIdx);	
+	void EmitBinarySwitchSection(BeSwitchInst* switchInst, int startIdx, int endIdx);
 
 	void EmitFrameOffset(const CeOperand& val);
 	void FlushPhi(CeBlock* ceBlock, int targetBlockIdx);
@@ -920,7 +920,7 @@ public:
 
 class CeStaticFieldInfo
 {
-public:	
+public:
 	addr_ce mAddr;
 
 public:
@@ -970,16 +970,16 @@ public:
 class CeEmitContext
 {
 public:
-	BfType* mType;	
+	BfType* mType;
 	BfMethodInstance* mMethodInstance;
-	Array<int32> mInterfaces;	
+	Array<int32> mInterfaces;
 	String mEmitData;
 	String mExitEmitData;
 	bool mFailed;
 
 	CeEmitContext()
 	{
-		mType = NULL;		
+		mType = NULL;
 		mMethodInstance = NULL;
 		mFailed = false;
 	}
@@ -1088,15 +1088,15 @@ public:
 	int mExecuteId;
 	CeEvalFlags mCurEvalFlags;
 
-	// These are only valid for the current execution	
+	// These are only valid for the current execution
 	ContiguousHeap* mHeap;
 	Array<CeFrame> mCallStack;
 	Array<uint8> mMemory;
 	int mStackSize;
 	Dictionary<int, addr_ce> mStringMap;
 	Dictionary<int, addr_ce> mReflectMap;
-	Dictionary<Val128, addr_ce> mConstDataMap;	
-	HashSet<int> mStaticCtorExecSet;	
+	Dictionary<Val128, addr_ce> mConstDataMap;
+	HashSet<int> mStaticCtorExecSet;
 	Dictionary<String, CeStaticFieldInfo> mStaticFieldMap;
 	Dictionary<int, CeInternalData*> mInternalDataMap;
 	int mCurHandleId;
@@ -1109,16 +1109,16 @@ public:
 	CeCallSource* mCurCallSource;
 	BfModule* mCurModule;
 	CeFrame* mCurFrame;
-	CeEmitContext* mCurEmitContext;	
+	CeEmitContext* mCurEmitContext;
 	String mWorkingDir;
 
 public:
 	CeContext();
 	~CeContext();
-	
+
 	BfError* Fail(const StringImpl& error);
 	BfError* Fail(const CeFrame& curFrame, const StringImpl& error);
-	
+
 	void CalcWorkingDir();
 	void FixRelativePath(StringImpl& path);
 	bool AddRebuild(const CeRebuildKey& key, const CeRebuildValue& value);
@@ -1143,8 +1143,8 @@ public:
 	bool GetCustomAttribute(BfModule* module, BfIRConstHolder* constHolder, BfCustomAttributes* customAttributes, int attributeIdx, addr_ce resultAddr);
 	BfType* GetCustomAttributeType(BfCustomAttributes* customAttributes, int attributeIdx);
 
-	bool WriteConstant(BfModule* module, addr_ce addr, BfConstant* constant, BfType* type, bool isParams = false);	
-	BfIRValue CreateConstant(BfModule* module, uint8* ptr, BfType* type, BfType** outType = NULL);	
+	bool WriteConstant(BfModule* module, addr_ce addr, BfConstant* constant, BfType* type, bool isParams = false);
+	BfIRValue CreateConstant(BfModule* module, uint8* ptr, BfType* type, BfType** outType = NULL);
 	BfIRValue CreateAttribute(BfAstNode* targetSrc, BfModule* module, BfIRConstHolder* constHolder, BfCustomAttribute* customAttribute, addr_ce ceAttrAddr = 0);
 
 	bool Execute(CeFunction* startFunction, uint8* startStackPtr, uint8* startFramePtr, BfType*& returnType, BfType*& castReturnType);
@@ -1173,14 +1173,14 @@ public:
 		Kind_Evaluate
 	};
 
-	Kind mKind;	
+	Kind mKind;
 	int mNextInstIdx;
 	int mStartDepth;
 
 public:
 	CeStepState()
 	{
-		mKind = Kind_None;		
+		mKind = Kind_None;
 		mNextInstIdx = -1;
 		mStartDepth = 0;
 	}
@@ -1194,24 +1194,24 @@ public:
 	Dictionary<int, CeFunction*> mFunctionIdMap; // Only used for 32-bit and debugging
 	Dictionary<BfType*, CeTypeInfo> mTypeInfoMap;
 	HashSet<BfMethodInstance*> mMethodInstanceSet;
-	HashSet<BfFieldInstance*> mFieldInstanceSet;	
-		
+	HashSet<BfFieldInstance*> mFieldInstanceSet;
+
 	Array<CeContext*> mContextList;
 
 	BfCompiler* mCompiler;
 	BfModule* mCeModule;
 	int mRevision;
 	int mMethodBindRevision;
-	int mRevisionExecuteTime;	
-	int mCurFunctionId;	
+	int mRevisionExecuteTime;
+	int mCurFunctionId;
 	int mExecuteId;
-	CeAppendAllocInfo* mAppendAllocInfo;	
-	
+	CeAppendAllocInfo* mAppendAllocInfo;
+
 	CeContext* mCurContext;
 	CeEmitContext* mCurEmitContext;
 	CeCallSource* mCurCallSource;
 	CeBuilder* mCurBuilder;
-	CeFunction* mPreparingFunction;		
+	CeFunction* mPreparingFunction;
 
 	BfParser* mTempParser;
 	BfReducer* mTempReducer;
@@ -1221,27 +1221,27 @@ public:
 	SyncEvent mDebugEvent;
 	CeStepState mStepState;
 	CeDebugger* mDebugger;
-	bool mDbgPaused;	
+	bool mDbgPaused;
 	bool mSpecialCheck;
 	bool mDbgWantBreak;
 
 public:
 	CeMachine(BfCompiler* compiler);
-	~CeMachine();		
+	~CeMachine();
 
-	void Init();		
+	void Init();
 	BeContext* GetBeContext();
 	BeModule* GetBeModule();
 
 	int GetInstSize(CeFunction* ceFunction, int instIdx);
 	void DerefMethodInfo(CeFunctionInfo* ceFunctionInfo);
 	void RemoveFunc(CeFunction* ceFunction);
-	void RemoveMethod(BfMethodInstance* methodInstance);					
-	void CreateFunction(BfMethodInstance* methodInstance, CeFunction* ceFunction);			
-	CeErrorKind WriteConstant(CeConstStructData& data, BeConstant* constVal, CeContext* ceContext);	
+	void RemoveMethod(BfMethodInstance* methodInstance);
+	void CreateFunction(BfMethodInstance* methodInstance, CeFunction* ceFunction);
+	CeErrorKind WriteConstant(CeConstStructData& data, BeConstant* constVal, CeContext* ceContext);
 
 	void CheckFunctionKind(CeFunction* ceFunction);
-	void PrepareFunction(CeFunction* methodInstance, CeBuilder* parentBuilder);	
+	void PrepareFunction(CeFunction* methodInstance, CeBuilder* parentBuilder);
 	void MapFunctionId(CeFunction* ceFunction);
 
 	void CheckFunctions();
@@ -1249,14 +1249,14 @@ public:
 	CeFunction* GetPreparedFunction(BfMethodInstance* methodInstance);
 	CeTypeInfo* GetTypeInfo(BfType* type);
 	BfMethodInstance* GetMethodInstance(int64 methodHandle);
-	BfFieldInstance* GetFieldInstance(int64 fieldHandle);	
+	BfFieldInstance* GetFieldInstance(int64 fieldHandle);
 
 public:
 	void CompileStarted();
 	void CompileDone();
 	CeFunction* QueueMethod(BfMethodInstance* methodInstance, BfIRValue func);
 	void QueueMethod(BfModuleMethodInstance moduleMethodInstance);
-	void QueueStaticField(BfFieldInstance* fieldInstance, const StringImpl& mangledFieldName);	
+	void QueueStaticField(BfFieldInstance* fieldInstance, const StringImpl& mangledFieldName);
 
 	void SetAppendAllocInfo(BfModule* module, BfIRValue allocValue, BfIRValue appendSizeValue);
 	void ClearAppendAllocInfo();
@@ -1277,7 +1277,7 @@ namespace std
 		{
 			return BeefHash<Beefy::String>()(key.mString) ^ (size_t)key.mKind;
 		}
-	};	
+	};
 
 	template <>
 	struct hash<Beefy::CeDbgInlineLookup>

+ 7 - 7
IDEHelper/Compiler/MemReporter.cpp

@@ -16,7 +16,7 @@ MemReporter::~MemReporter()
 int MemReporter::GetChildSizes(Entry* entry)
 {
 	int childSizes = 0;
-	for (auto& childPair : entry->mChildren)		
+	for (auto& childPair : entry->mChildren)
 	{
 		auto child = childPair.mValue;
 		childSizes += child->mSize + GetChildSizes(child);
@@ -29,10 +29,10 @@ void MemReporter::Report(int depth, Entry* entry)
 	String str;
 	for (int i = 0; i < depth; i++)
 		str += "  ";
-	
+
 	str += entry->mName;
 	while (str.length() < 64)
-		str +=  ' ';	
+		str +=  ' ';
 
 	if (entry->mChildSize == -1)
 		entry->mChildSize = GetChildSizes(entry);
@@ -45,7 +45,7 @@ void MemReporter::Report(int depth, Entry* entry)
 
 	Array<Entry*> entries;
 	for (auto& kv : entry->mChildren)
-	{ 
+	{
 		auto* entry = kv.mValue;
 		entry->mChildSize = GetChildSizes(entry);
 		entries.Add(kv.mValue);
@@ -63,7 +63,7 @@ void MemReporter::BeginSection(const StringView& name)
 {
 	Entry** entryPtr;
 	if (!mCurEntry->mChildren.TryAdd(StringImpl::MakeRef(name), NULL, &entryPtr))
-	{		
+	{
 		mCurEntry = *entryPtr;
 		mCurEntry->mCount++;
 		return;
@@ -95,6 +95,6 @@ void MemReporter::EndSection()
 }
 
 void MemReporter::Report()
-{		
+{
 	Report(0, &mRoot);
-}
+}

+ 16 - 17
IDEHelper/Compiler/MemReporter.h

@@ -36,24 +36,24 @@ public:
 	Entry* mCurEntry;
 	bool mShowInKB;
 
-public:	
+public:
 	int GetChildSizes(Entry* entry);
 	void Report(int depth, Entry* entry);
 
-public:	
+public:
 	MemReporter();
 	~MemReporter();
 
 	void BeginSection(const StringView& name);
 	void Add(int size);
 	void Add(const StringView& name, int size);
-	
+
 	template <typename T>
 	void AddVec(const T& vec, bool addContainerSize = true)
 	{
 		Add((addContainerSize ? sizeof(T) : 0) + (int)vec.mAllocSize * sizeof(typename T::value_type));
 	}
-	
+
 	template <typename T>
 	void AddVec(const StringView& name, const T& vec, bool addContainerSize = true)
 	{
@@ -61,21 +61,21 @@ public:
 		Add((addContainerSize ? sizeof(T) : 0) + (int)vec.mAllocSize * sizeof(typename T::value_type));
 		EndSection();
 	}
-	
+
 	template <typename T>
 	void AddVecPtr(const std::vector<T>& vec, bool addContainerSize = true)
 	{
 		Add((addContainerSize ? sizeof(T) : 0) +
-			(int)vec.capacity() * sizeof(T) + 
+			(int)vec.capacity() * sizeof(T) +
 			(int)vec.size() * sizeof(typename std::remove_pointer<T>::type)); //-V220
 	}
-	
+
 	template <typename T>
 	void AddVecPtr(const Array<T>& vec, bool addContainerSize = true)
 	{
 		Add((addContainerSize ? sizeof(T) : 0) +
 			(int)vec.mAllocSize * sizeof(T) +
-			(int)vec.size() * sizeof(typename std::remove_pointer<T>::type)); //-V220		
+			(int)vec.size() * sizeof(typename std::remove_pointer<T>::type)); //-V220
 	}
 
 	template <typename T>
@@ -83,12 +83,12 @@ public:
 	{
 		Add(name, (addContainerSize ? sizeof(T) : 0) +
 			(int)vec.mAllocSize * sizeof(T) +
-			(int)vec.size() * sizeof(typename std::remove_pointer<T>::type)); //-V220		
+			(int)vec.size() * sizeof(typename std::remove_pointer<T>::type)); //-V220
 	}
 
 	template <typename T>
 	void AddMap(const StringView& name, const T& map, bool addContainerSize = true)
-	{		
+	{
 		Add(name, (addContainerSize ? sizeof(T) : 0) + map.mAllocSize * (sizeof(typename T::EntryPair) + sizeof(typename T::int_cosize)));
 	}
 
@@ -109,7 +109,7 @@ public:
 	{
 		Add((addContainerSize ? sizeof(T) : 0) + map.mAllocSize * (sizeof(typename T::Entry) + sizeof(typename T::int_cosize)));
 	}
-	
+
 	void AddStr(const StringImpl& str, bool addContainerSize = true)
 	{
 		Add((addContainerSize ? sizeof(StringImpl) : 0) + (int)str.GetAllocSize());
@@ -123,12 +123,11 @@ public:
 	void EndSection();
 	void Report();
 
-
 	template <typename T>
 	void AddBumpAlloc(const StringView& name, const T& alloc)
-	{		
+	{
 		BeginSection(name);
-				
+
 		int usedSize = alloc.CalcUsedSize();
 #ifdef BUMPALLOC_TRACKALLOCS
 
@@ -162,9 +161,9 @@ public:
 			Add("Unaccounted", usedSizeLeft);
 #else
 		Add("Used", usedSize);
-#endif		
+#endif
 		Add("Waste", alloc.GetAllocSize() - usedSize);
-		Add("Unused", alloc.GetTotalAllocSize() - alloc.GetAllocSize());		
+		Add("Unused", alloc.GetTotalAllocSize() - alloc.GetAllocSize());
 
 		EndSection();
 	}
@@ -173,7 +172,7 @@ public:
 class AutoMemReporter
 {
 public:
-	MemReporter* mMemReporter;	
+	MemReporter* mMemReporter;
 
 public:
 	AutoMemReporter(MemReporter* memReporter, const StringImpl& name)

+ 7 - 7
IDEHelper/DbgMiniDump.cpp

@@ -3,7 +3,7 @@
 
 USING_NS_BF;
 
-enum DbgMiniDumpFlags 
+enum DbgMiniDumpFlags
 {
 	DbgMiniDumpFlag_MiniDumpNormal = 0x00000000,
 	DbgMiniDumpFlag_MiniDumpWithDataSegs = 0x00000001,
@@ -41,18 +41,18 @@ bool DbgMiniDump::StartLoad(const StringImpl& path)
 		uint32 mVersion;
 		uint32 mNumberOfStreams;
 		uint32 mStreamDirectoryRVA;
-		uint32 mCheckSum;		
-		uint32 TimeDateStamp;		
+		uint32 mCheckSum;
+		uint32 TimeDateStamp;
 		uint64 Flags;
 	};
 
-	_Header& header = *(_Header*)((uint8*)mMF.mData);	
+	_Header& header = *(_Header*)((uint8*)mMF.mData);
 	if (header.mSignature != 'PMDM')
 		return false;
-	
+
 	mDirectory.mVals = (StreamDirectoryEntry*)((uint8*)mMF.mData + header.mStreamDirectoryRVA);
 	mDirectory.mSize = header.mNumberOfStreams;
-		
+
 	return true;
 }
 
@@ -72,4 +72,4 @@ int DbgMiniDump::GetTargetBitCount()
 	}
 
 	return 0;
-}
+}

+ 1 - 1
IDEHelper/DbgMiniDump.h

@@ -46,7 +46,7 @@ public:
 	bool StartLoad(const StringImpl& path);
 	int GetTargetBitCount();
 
-	template <typename T> 
+	template <typename T>
 	T& GetStreamData(const StreamDirectoryEntry& entry)
 	{
 		return *(T*)((uint8*)mMF.mData + entry.mDataRVA);

+ 57 - 72
IDEHelper/DebugManager.cpp

@@ -80,7 +80,7 @@ DebugManager::DebugManager()
 	mStepOverExternalFiles = false;
 
 	mDebugger32 = NULL;
-	mDebugger64 = NULL;	
+	mDebugger64 = NULL;
 	mNetManager = new NetManager();
 	mNetManager->mDebugManager = this;
 
@@ -106,12 +106,11 @@ DebugManager::~DebugManager()
 
 	delete mNetManager;
 	delete mDebugger64;
-	delete mDebugger32;		
+	delete mDebugger32;
 	/*for (auto stepFilter : mStepFilters)
 	{
-
 	}*/
-	delete mDebugVisualizers;	
+	delete mDebugVisualizers;
 }
 
 void DebugManager::OutputMessage(const StringImpl& msg)
@@ -144,7 +143,6 @@ void DebugManager::SetSourceServerCacheDir()
 #endif
 }
 
-
 //#define CAPTURE_ALLOC_BACKTRACE
 //#define CAPTURE_ALLOC_SOURCES
 
@@ -153,7 +151,7 @@ const int sNumAllocAddrs = 0x300000;
 const int sCaptureDepth = 14;
 const int sCaptureOffset = 4;
 static intptr gAllocAddrs[sNumAllocAddrs][sCaptureDepth];
-#endif 
+#endif
 
 #ifdef CAPTURE_ALLOC_SOURCES
 #include <Dbghelp.h>
@@ -191,7 +189,7 @@ static void ReallocEntry(long oldRequest, long newRequest, int newSize)
 		entry->mAllocSize = newSize;
 		gBfCaptureSourceAllocMap[newRequest] = *entry;
 		gBfCaptureSourceAllocMap.erase(itr);
-	}	
+	}
 }
 
 static void RemoveAllocEntry(long lRequest)
@@ -203,13 +201,11 @@ static void RemoveAllocEntry(long lRequest)
 
 		entry->mLoc->mTotalSize -= entry->mAllocSize;
 		gBfCaptureSourceAllocMap.erase(itr);
-	}	
+	}
 }
 
-
 //const LOC_HASHES
 
-
 #endif
 
 static int gBfNumAllocs = 0;
@@ -246,7 +242,7 @@ static int BfAllocHook(int nAllocType, void *pvData,
 	if (hProcess == NULL)
 	{
 		hProcess = GetCurrentProcess();
-		BOOL worked = SymInitialize(hProcess, NULL, TRUE);		
+		BOOL worked = SymInitialize(hProcess, NULL, TRUE);
 	}
 
 	if (nAllocType == _HOOK_ALLOC)
@@ -317,7 +313,6 @@ static int BfAllocHook(int nAllocType, void *pvData,
 
 				if ((captureAllocLoc->mIsEndpoint) && (foundSym))
 				{
-					
 				}
 
 				gHashCaptureAllocSize[hashVal] = captureAllocLoc;
@@ -330,7 +325,6 @@ static int BfAllocHook(int nAllocType, void *pvData,
 				continue;
 			}
 
-
 			captureAllocLoc->mTotalSize += (int)nSize;
 
 			CaptureAllocEntry entry;
@@ -433,19 +427,18 @@ static int BfAllocHook(int nAllocType, void *pvData,
 
 #endif //BF_PLATFORM_WINDOWS
 
-
 void BfReportMemory()
 {
 	BfLogDbg("Used: %.2fM NumAllocs: %d Allocs: %.2fM\n", (gBfAllocCount - gBfFreeCount) / (1024.0 * 1024.0), gBfNumAllocs, gBfAllocCount / (1024.0 * 1024.0));
 }
 
 void BfFullReportMemory()
-{		
+{
 	/*OutputDebugStrF("Testing OOB\n");
 	char* str = new char[12];
 	delete str;
 	char c = str[1];*/
-	
+
 	if (gBfParserCache != NULL)
 	{
 		MemReporter memReporter;
@@ -457,7 +450,7 @@ void BfFullReportMemory()
 
 	OutputDebugStrF("Used: %.2fM NumAllocs: %d Allocs: %.2fM\n", (gBfAllocCount - gBfFreeCount) / (1024.0 * 1024.0), gBfNumAllocs, gBfAllocCount / (1024.0 * 1024.0));
 	OutputDebugStrF("ChunkedDataBuffer allocated blocks: %d\n", ChunkedDataBuffer::sBlocksAllocated);
-	
+
 	if (gDebugManager != NULL)
 	{
 		MemReporter memReporter;
@@ -493,7 +486,7 @@ void BfFullReportMemory()
 
 	for (auto kv : byNameMap)
 	{
-		//OutputDebugStrF("%dk %s\n", (kv.second + 1023) / 1024, kv.first.c_str());		
+		//OutputDebugStrF("%dk %s\n", (kv.second + 1023) / 1024, kv.first.c_str());
 		bySizeMap.insert(std::multimap<int, String>::value_type(-kv.second, kv.first));
 	}
 
@@ -528,7 +521,7 @@ struct _CrtMemBlockHeader
 //static _CrtMemBlockHeader* __acrt_last_block;
 
 void ShowMemoryUsage()
-{	
+{
 #ifdef BF_PLATFORM_WINDOWS
 	PROCESS_MEMORY_COUNTERS processMemCounters;
 	processMemCounters.cb = sizeof(PROCESS_MEMORY_COUNTERS);
@@ -538,7 +531,7 @@ void ShowMemoryUsage()
 
 	static bool hasCheckpoint = true;
 	_CrtMemState memState;
-	_CrtMemCheckpoint(&memState);	
+	_CrtMemCheckpoint(&memState);
 	//OutputDebugStrF("Crt Size: %dk\n", (int)(memState.lTotalCount / 1024));
 
 	char* names[6] = { "_FREE_BLOCK", "_NORMAL_BLOCK", "_CRT_BLOCK", "_IGNORE_BLOCK", "_CLIENT_BLOCK", "_MAX_BLOCKS" };
@@ -546,7 +539,7 @@ void ShowMemoryUsage()
 	{
 		OutputDebugStrF("%s : %d %dk\n", names[i], memState.lCounts[i], memState.lSizes[i] / 1024);
 	}
-	
+
 #ifdef _DEBUG
 // 	int64 totalCrtSize = 0;
 // 	int64 totalUseCrtSize = 0;
@@ -568,9 +561,9 @@ void ShowMemoryUsage()
 	while ((heapStatus = _heapwalk(&heapInfo)) == _HEAPOK)
 	{
 		heapSize += (int64)heapInfo._size;
-	}		
+	}
 	OutputDebugStrF("WALKED HEAP SIZE: %dk\n", heapSize / 1024);
-	
+
 	//_CrtMemDumpStatistics(&memState);
 #endif
 }
@@ -591,9 +584,7 @@ BOOL WINAPI DllMain(
 	HANDLE  hDllHandle,
 	DWORD   dwReason,
 	LPVOID  lpreserved)
-{	
-	
-
+{
 	if (dwReason == DLL_PROCESS_ATTACH)
 	{
 		BpInit("127.0.0.1", "Beef IDE");
@@ -638,13 +629,13 @@ namespace BeefyDbg64
 static _CrtMemState gStartMemCheckpoint;
 #endif
 BF_EXPORT void BF_CALLTYPE Debugger_Create()
-{			
+{
 	//TODO: Very slow, remove
 	//_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF);
 	//_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_EVERY_16_DF);
 	//TODO: _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF /*| _CRTDBG_CHECK_EVERY_16_DF*/);
 	//_CrtSetAllocHook(BfAllocHook);
-	
+
 #ifdef BF_PLATFORM_WINDOWS
 	_CrtMemCheckpoint(&gStartMemCheckpoint);
 #endif
@@ -661,7 +652,7 @@ BF_EXPORT void BF_CALLTYPE Debugger_Create()
 	gDebugManager->mDebugger64 = NULL;
 #else
 	gDebugManager->mDebugger64 = CreateDebugger64(gDebugManager, NULL);
-#endif	
+#endif
 
 #ifdef BF_PLATFORM_WINDOWS
 	::AllowSetForegroundWindow(ASFW_ANY);
@@ -672,12 +663,11 @@ BF_EXPORT void BF_CALLTYPE Debugger_Create()
 
 BF_EXPORT void BF_CALLTYPE Debugger_SetCallbacks(void* callback)
 {
-
 }
 
 BF_EXPORT void BF_CALLTYPE Debugger_FullReportMemory()
 {
-	//WdAllocTest();	
+	//WdAllocTest();
 	ShowMemoryUsage();
 	BfFullReportMemory();
 }
@@ -777,7 +767,7 @@ BF_EXPORT bool BF_CALLTYPE Debugger_OpenFile(const char* launchPath, const char*
 
 	Array<uint8> envBlock;
 	if (envBlockPtr != NULL)
-	{		
+	{
 		if (envBlockSize != 0)
 			envBlock.Insert(0, (uint8*)envBlockPtr, envBlockSize);
 	}
@@ -787,7 +777,7 @@ BF_EXPORT bool BF_CALLTYPE Debugger_OpenFile(const char* launchPath, const char*
 }
 
 BF_EXPORT bool BF_CALLTYPE Debugger_ComptimeAttach(void* bfCompiler)
-{	
+{
 	gDebugger = new CeDebugger(gDebugManager, (BfCompiler*)bfCompiler);
 	return true;
 }
@@ -808,12 +798,12 @@ BF_EXPORT void BF_CALLTYPE Debugger_SetSymSrvOptions(const char* symCacheDir, co
 			if (!symStr.IsEmpty())
 				symServers.Add(symStr);
 			startStr = cPtr;
-		}		
+		}
 
 		if (*cPtr == 0)
 			break;
 	}
-	
+
 	AutoCrit autoCrit(gDebugManager->mCritSect);
 
 	gDebugManager->mSymSrvOptions.mCacheDir = symCacheDir;
@@ -834,12 +824,11 @@ BF_EXPORT void BF_CALLTYPE Debugger_SetSymSrvOptions(const char* symCacheDir, co
 	}
 
 	gDebugManager->SetSourceServerCacheDir();
-
 }
 
 BF_EXPORT bool BF_CALLTYPE Debugger_OpenMiniDump(const char* fileName)
 {
-#ifdef BF_PLATFORM_WINDOWS	
+#ifdef BF_PLATFORM_WINDOWS
 	DbgMiniDump* dbgMiniDump = new DbgMiniDump();
 	bool result = dbgMiniDump->StartLoad(fileName);
 	if (!result)
@@ -847,7 +836,6 @@ BF_EXPORT bool BF_CALLTYPE Debugger_OpenMiniDump(const char* fileName)
 		delete dbgMiniDump;
 		return false;
 	}
-	
 
 	if (dbgMiniDump->GetTargetBitCount() == 32)
 		gDebugger = CreateDebugger32(gDebugManager, dbgMiniDump);
@@ -875,7 +863,7 @@ BF_EXPORT bool BF_CALLTYPE Debugger_Attach(int processId, BfDbgAttachFlags attac
 		gDebugger = gDebugManager->mDebugger32;
 		return true;
 	}
-	
+
 	return false;
 }
 
@@ -886,7 +874,7 @@ BF_EXPORT void BF_CALLTYPE Debugger_Run()
 
 BF_EXPORT bool BF_CALLTYPE Debugger_HotLoad(const char* fileNamesStr, int hotIdx)
 {
-	//DbgModule* dwarf = new DbgModule(gDebugger);	
+	//DbgModule* dwarf = new DbgModule(gDebugger);
 	//dwarf->ReadPE(fileName);
 
 	Array<String> fileNames;
@@ -919,8 +907,8 @@ BF_EXPORT bool BF_CALLTYPE Debugger_HotLoad(const char* fileNamesStr, int hotIdx
 BF_EXPORT bool BF_CALLTYPE Debugger_LoadDebugVisualizers(const char* fileName)
 {
 	String fn = fileName;
-	bool worked = false;	
-	worked = gDebugManager->mDebugVisualizers->Load(fileName);	
+	bool worked = false;
+	worked = gDebugManager->mDebugVisualizers->Load(fileName);
 	if (!gDebugManager->mDebugVisualizers->mErrorString.empty())
 	{
 		gDebugManager->mOutMessages.push_back(StrFormat("msg ERROR: %s\n", gDebugManager->mDebugVisualizers->mErrorString.c_str()));
@@ -999,7 +987,7 @@ BF_EXPORT void BF_CALLTYPE Breakpoint_HotBindBreakpoint(Breakpoint* breakpoint,
 
 BF_EXPORT void BF_CALLTYPE Breakpoint_SetThreadId(Breakpoint* breakpoint, intptr threadId)
 {
-	BfLogDbg("Breakpoint %p set ThreadId=%d\n", breakpoint, threadId);	
+	BfLogDbg("Breakpoint %p set ThreadId=%d\n", breakpoint, threadId);
 	breakpoint->mThreadId = threadId;
 	gDebugger->CheckBreakpoint(breakpoint);
 }
@@ -1064,19 +1052,19 @@ BF_EXPORT void BF_CALLTYPE Breakpoint_Disable(Breakpoint* wdBreakpoint)
 
 BF_EXPORT void BF_CALLTYPE Debugger_CreateStepFilter(const char* filter, bool isGlobal, BfStepFilterKind filterKind)
 {
-	AutoCrit autoCrit(gDebugManager->mCritSect);	
+	AutoCrit autoCrit(gDebugManager->mCritSect);
 	StepFilter stepFilter;
 	stepFilter.mFilterKind = filterKind;
 	gDebugManager->mStepFilters[filter] = stepFilter;
-	gDebugManager->mStepFilterVersion++;	
+	gDebugManager->mStepFilterVersion++;
 }
 
 BF_EXPORT void BF_CALLTYPE StepFilter_Delete(const char* filter)
 {
-	AutoCrit autoCrit(gDebugManager->mCritSect);	
+	AutoCrit autoCrit(gDebugManager->mCritSect);
 	bool didRemove = gDebugManager->mStepFilters.Remove(filter);
 	BF_ASSERT(didRemove);
-	
+
 	gDebugManager->mStepFilterVersion++;
 }
 
@@ -1110,7 +1098,7 @@ BF_EXPORT const char* BF_CALLTYPE Debugger_PopMessage()
 BF_EXPORT bool BF_CALLTYPE Debugger_HasMessages()
 {
 	AutoCrit autoCrit(gDebugManager->mCritSect);
-	return gDebugManager->mOutMessages.size() != 0;		
+	return gDebugManager->mOutMessages.size() != 0;
 }
 
 BF_EXPORT const char* BF_CALLTYPE Debugger_GetCurrentException()
@@ -1177,7 +1165,7 @@ BF_EXPORT void BF_CALLTYPE Debugger_SetDisplayTypes(const char* referenceId, con
 		displayInfo = &gDebugManager->mDefaultDisplayInfo;
 	else
 		gDebugManager->mDisplayInfos.TryAdd(referenceId, NULL, &displayInfo);
-	
+
 	if (formatStr != NULL)
 		displayInfo->mFormatStr = formatStr;
 	displayInfo->mIntDisplayType = (DwIntDisplayType)intDisplayType;
@@ -1246,11 +1234,11 @@ BF_EXPORT const char* BF_CALLTYPE Debugger_EvaluateContinue()
 BF_EXPORT void BF_CALLTYPE Debugger_EvaluateContinueKeep()
 {
 	auto debugger = gDebugger;
-	debugger->EvaluateContinueKeep();	
+	debugger->EvaluateContinueKeep();
 }
 
 BF_EXPORT StringView BF_CALLTYPE Debugger_Evaluate(const char* expr, int callStackIdx, int cursorPos, int32 language, uint16 expressionFlags)
-{	
+{
 	auto debugger = gDebugger;
 
 	if (debugger == NULL)
@@ -1291,39 +1279,37 @@ BF_EXPORT const char* BF_CALLTYPE Debugger_EvaluateAtAddress(const char* expr, i
 
 BF_EXPORT const char* BF_CALLTYPE Debugger_GetAutoExpressions(int callStackIdx, uint64 memoryRangeStart, uint64 memoryRangeLen)
 {
-	String& outString = *gTLStrReturn.Get();	
+	String& outString = *gTLStrReturn.Get();
 	outString = gDebugger->GetAutoExpressions(callStackIdx, memoryRangeStart, memoryRangeLen);
 	return outString.c_str();
 }
 
 BF_EXPORT const char* BF_CALLTYPE Debugger_GetAutoLocals(int callStackIdx, bool showRegs)
 {
-	String& outString = *gTLStrReturn.Get();	
+	String& outString = *gTLStrReturn.Get();
 	outString = gDebugger->GetAutoLocals(callStackIdx, showRegs);
 	return outString.c_str();
 }
 
 BF_EXPORT const char* BF_CALLTYPE Debugger_CompactChildExpression(const char* expr, const char* parentExpr, int callStackIdx)
 {
-	String& outString = *gTLStrReturn.Get();	
+	String& outString = *gTLStrReturn.Get();
 	outString = gDebugger->CompactChildExpression(expr, parentExpr, callStackIdx);
 	return outString.c_str();
 }
 
 BF_EXPORT const char* BF_CALLTYPE Debugger_GetCollectionContinuation(const char* continuationData, int callStackIdx, int count)
 {
-	String& outString = *gTLStrReturn.Get();	
+	String& outString = *gTLStrReturn.Get();
 	outString = gDebugger->GetCollectionContinuation(continuationData, callStackIdx, count);
 	return outString.c_str();
 }
 
-
 BF_EXPORT void BF_CALLTYPE Debugger_ForegroundTarget()
 {
 	gDebugger->ForegroundTarget();
-	
 
-	//BOOL worked = EnumThreadWindows(gDebugger->mProcessInfo.dwThreadId, WdEnumWindowsProc, 0);	
+	//BOOL worked = EnumThreadWindows(gDebugger->mProcessInfo.dwThreadId, WdEnumWindowsProc, 0);
 	//BF_ASSERT(worked);
 }
 
@@ -1394,7 +1380,7 @@ BF_EXPORT int BF_CALLTYPE CallStack_GetBreakStackFrameIdx()
 
 BF_EXPORT const char* BF_CALLTYPE CallStack_GetStackFrameInfo(int stackFrameIdx, intptr* addr, const char** outFile, int32* outHotIdx, int32* outDefLineStart, int32* outDefLineEnd,
 	int32* outLine, int32* outColumn, int32* outLanguage, int32* outStackSize, int8* outFlags)
-{	
+{
 	String& outString = *gTLStrReturn.Get();
 	String& outString2 = *gTLStrReturn2.Get();
 
@@ -1413,7 +1399,7 @@ BF_EXPORT const char* BF_CALLTYPE CallStack_GetStackFrameId(int stackFrameIdx)
 BF_EXPORT const char* BF_CALLTYPE Callstack_GetStackFrameOldFileInfo(int stackFrameIdx)
 {
 	String& outString = *gTLStrReturn.Get();
-	outString = gDebugger->Callstack_GetStackFrameOldFileInfo(stackFrameIdx);	
+	outString = gDebugger->Callstack_GetStackFrameOldFileInfo(stackFrameIdx);
 	return outString.c_str();
 }
 
@@ -1531,7 +1517,7 @@ BF_EXPORT int BF_CALLTYPE Debugger_LoadDebugInfoForModuleWith(const char* module
 }
 
 BF_EXPORT void BF_CALLTYPE Debugger_SetStepOverExternalFiles(bool stepOverExternalFiles)
-{	
+{
 	gDebugManager->mStepOverExternalFiles = stepOverExternalFiles;
 	gDebugManager->mStepFilterVersion++;
 }
@@ -1552,7 +1538,7 @@ BF_EXPORT Profiler* BF_CALLTYPE Debugger_StartProfiling(intptr threadId, char* d
 	Profiler* profiler = gDebugger->StartProfiling();
 	profiler->mTargetThreadId = threadId;
 	if (desc != NULL)
-		profiler->mDescription = desc;	
+		profiler->mDescription = desc;
 	profiler->mSamplesPerSecond = sampleRate;
 	profiler->Start();
 	return profiler;
@@ -1560,7 +1546,7 @@ BF_EXPORT Profiler* BF_CALLTYPE Debugger_StartProfiling(intptr threadId, char* d
 
 BF_EXPORT Profiler* BF_CALLTYPE Debugger_PopProfiler()
 {
-	Profiler* profiler = gDebugger->PopProfiler();	
+	Profiler* profiler = gDebugger->PopProfiler();
 	return profiler;
 }
 
@@ -1570,7 +1556,6 @@ BF_EXPORT void BF_CALLTYPE Debugger_InitiateHotResolve(int flags)
 		gDebugger->InitiateHotResolve((DbgHotResolveFlags)flags);
 }
 
-
 BF_EXPORT intptr BF_CALLTYPE Debugger_GetDbgAllocHeapSize()
 {
 	AutoCrit autoCrit(gDebugManager->mCritSect);
@@ -1580,7 +1565,7 @@ BF_EXPORT intptr BF_CALLTYPE Debugger_GetDbgAllocHeapSize()
 BF_EXPORT const char* BF_CALLTYPE Debugger_GetDbgAllocInfo()
 {
 	AutoCrit autoCrit(gDebugManager->mCritSect);
-	
+
 	String& outString = *gTLStrReturn.Get();
 	outString = gDebugger->GetDbgAllocInfo();
 	return outString.c_str();
@@ -1640,7 +1625,7 @@ BF_EXPORT NetResult* HTTP_GetFile(char* url, char* destPath)
 {
 	AutoCrit autoCrit(gDebugManager->mNetManager->mThreadPool.mCritSect);
 
-	auto netResult = gDebugManager->mNetManager->QueueGet(url, destPath, false);	
+	auto netResult = gDebugManager->mNetManager->QueueGet(url, destPath, false);
 	netResult->mDoneEvent = new SyncEvent();
 	return netResult;
 }
@@ -1674,7 +1659,7 @@ BF_EXPORT void HTTP_Delete(NetResult* netResult)
 				netResult->mCurRequest->Cancel();
 		}
 		netResult->mDoneEvent->WaitFor(-1);
-	}				
+	}
 	delete netResult;
 }
 
@@ -1738,12 +1723,12 @@ BF_EXPORT void BF_CALLTYPE TimeTest(uint32 startTime)
 }
 
 BF_EXPORT void BF_CALLTYPE BFTest()
-{	
+{
 	struct DeferredResolveEntry2
 	{
 		BfFieldDef* mFieldDef;
 		int mTypeArrayIdx;
-	};	
+	};
 
 	DeferredResolveEntry2 entry = { NULL, 333 };
 
@@ -1752,10 +1737,10 @@ BF_EXPORT void BF_CALLTYPE BFTest()
 	vec.push_back(DeferredResolveEntry2 { NULL, 222 } );
 }
 
-///	
+///
 
-// __attribute__((weak)) 
+// __attribute__((weak))
 // Debugger* Beefy::CreateDebugger32(DebugManager* debugManager, DbgMiniDump* miniDump)
 // {
 // 	return NULL;
-// }
+// }

+ 3 - 3
IDEHelper/DebugManager.h

@@ -44,7 +44,7 @@ public:
 	StepFilter()
 	{
 		// Set global / local
-		mFilterKind = BfStepFilterKind_Filtered;		
+		mFilterKind = BfStepFilterKind_Filtered;
 	}
 
 	bool IsFiltered(bool defaultValue)
@@ -65,11 +65,11 @@ class DebugManager
 {
 public:
 	Debugger* mDebugger32;
-	Debugger* mDebugger64;	
+	Debugger* mDebugger64;
 
 	CritSect mCritSect;
 	Dictionary<String, StepFilter> mStepFilters;
-	int mStepFilterVersion;	
+	int mStepFilterVersion;
 	std::deque<String> mOutMessages;
 
 	DebugVisualizers* mDebugVisualizers;

+ 17 - 18
IDEHelper/DebugVisualizers.cpp

@@ -5,7 +5,7 @@ USING_NS_BF;
 void DebugVisualizers::Fail(const StringImpl& error)
 {
 	if (mErrorString.length() != 0)
-		return;	
+		return;
 	mErrorString = StrFormat("Debug visualizer failure: %s in %s", error.c_str(), mCurFileName.c_str());
 }
 
@@ -125,7 +125,7 @@ bool DebugVisualizers::ReadFileTOML(const StringImpl& fileName)
 					else if ((name == "DisplayString") | (name == "StringView"))
 					{
 						bool isStringView = name == "StringView";
-						
+
 						if (value.is<toml::Array>())
 						{
 							for (auto& displayValue : ExpectArray(value))
@@ -143,7 +143,7 @@ bool DebugVisualizers::ReadFileTOML(const StringImpl& fileName)
 									else
 										Fail("Unexpected entry", value);
 								}
-								
+
 								if (isStringView)
 									entry->mStringViews.push_back(displayStringEntry);
 								else
@@ -158,7 +158,7 @@ bool DebugVisualizers::ReadFileTOML(const StringImpl& fileName)
 								entry->mStringViews.push_back(displayStringEntry);
 							else
 								entry->mDisplayStrings.push_back(displayStringEntry);
-						}						
+						}
 					}
 					else if (name == "Action")
 					{
@@ -193,7 +193,7 @@ bool DebugVisualizers::ReadFileTOML(const StringImpl& fileName)
 										else if (name == "Condition")
 											expandItem->mCondition = ExpectString(value);
 										else
-											Fail("Unexpected entry", value);										
+											Fail("Unexpected entry", value);
 									}
 								}
 							}
@@ -234,7 +234,7 @@ bool DebugVisualizers::ReadFileTOML(const StringImpl& fileName)
 									else if (name == "LowerDimSizes")
 									{
 										for (auto& dimValue : ExpectArray(value))
-											entry->mLowerDimSizes.push_back(ExpectString(dimValue));											
+											entry->mLowerDimSizes.push_back(ExpectString(dimValue));
 									}
 									else if (name == "ValueNode")
 										entry->mValuePointer = ExpectString(value);
@@ -364,7 +364,7 @@ bool DebugVisualizers::Load(const StringImpl& fileNamesStr)
 		fileNames.Add(fileNamesStr.Substring(startIdx, crPos - startIdx));
 		startIdx = crPos + 1;
 	}
-	
+
 	HashContext hashCtx;
 	for (auto fileName : fileNames)
 	{
@@ -376,7 +376,7 @@ bool DebugVisualizers::Load(const StringImpl& fileNamesStr)
 		}
 		hashCtx.Mixin(lastWrite);
 	}
-	
+
 	Val128 hash = hashCtx.Finish128();
 	if ((hash == mHash) && (!hasError))
 		return true;
@@ -394,13 +394,12 @@ bool DebugVisualizers::Load(const StringImpl& fileNamesStr)
 	return success;
 }
 
-
 DebugVisualizerEntry* DebugVisualizers::FindEntryForType(const StringImpl& typeName, DbgFlavor wantFlavor, Array<String>* wildcardCaptures)
-{	
+{
 	//TODO: Do smarter name matching. Right now we just compare up to the '*'
-	
+
 	for (auto entry : mDebugVisualizers)
-	{		
+	{
 		if ((entry->mFlavor != DbgFlavor_Unknown) && (entry->mFlavor != wantFlavor))
 			continue;
 
@@ -435,7 +434,7 @@ DebugVisualizerEntry* DebugVisualizers::FindEntryForType(const StringImpl& typeN
 				int openDepth = 0;
 				String wildcardCapture;
 				while (true)
-				{					
+				{
 					typeC = *typeCharP;
 
 					bool isSep = typeC == ',';
@@ -459,7 +458,7 @@ DebugVisualizerEntry* DebugVisualizers::FindEntryForType(const StringImpl& typeN
 					{
 						typeCharP--;
 						break;
-					}			
+					}
 
 					wildcardCapture += typeC;
 					typeCharP++;
@@ -476,14 +475,14 @@ DebugVisualizerEntry* DebugVisualizers::FindEntryForType(const StringImpl& typeN
 			}
 			else if (entryC != typeC)
 				break;
-			
+
 			typeCharP++;
 			entryCharP++;
 		}
 
 		if (wildcardCaptures != NULL)
-			wildcardCaptures->Clear();		
-	}	
+			wildcardCaptures->Clear();
+	}
 
 	return NULL;
 }
@@ -504,4 +503,4 @@ String DebugVisualizers::DoStringReplace(const StringImpl& origStr, const Array<
 		}
 	}
 	return newString;
-}
+}

+ 6 - 6
IDEHelper/DebugVisualizers.h

@@ -48,7 +48,7 @@ public:
 
 	OwnedVector<ExpandItem> mExpandItems;
 	CollectionType mCollectionType;
-	
+
 	String mSize;
 	Array<String> mLowerDimSizes;
 	String mNextPointer;
@@ -58,11 +58,11 @@ public:
 	String mRightPointer;
 	String mValueType;
 	String mValuePointer;
-	String mTargetPointer;		
+	String mTargetPointer;
 	String mCondition;
 	String mBuckets;
 	String mEntries;
-	String mKey;		
+	String mKey;
 	bool mShowedError;
 	bool mShowElementAddrs;
 
@@ -76,7 +76,7 @@ public:
 		mCollectionType = CollectionType_None;
 		mShowedError = false;
 		mShowElementAddrs = false;
-	}	
+	}
 };
 
 class DebugVisualizers
@@ -87,9 +87,9 @@ public:
 	String mCurFileName;
 	const char* mSrcStr;
 	OwnedVector<DebugVisualizerEntry> mDebugVisualizers;
-	
+
 	void Fail(const StringImpl& error);
-	void Fail(const StringImpl& error, const toml::Value& value);	
+	void Fail(const StringImpl& error, const toml::Value& value);
 
 	String ExpectString(const toml::Value& value);
 	bool ExpectBool(const toml::Value& value);

+ 7 - 7
IDEHelper/Debugger.cpp

@@ -5,7 +5,7 @@
 USING_NS_BF;
 
 DbgModuleMemoryCache::DbgModuleMemoryCache(uintptr addr, int size)
-{	
+{
 	mAddr = addr;
 	mSize = size;
 
@@ -27,7 +27,7 @@ DbgModuleMemoryCache::DbgModuleMemoryCache(uintptr addr, int size)
 // 	mBlocks = new uint8*[1];
 // 	mFlags = new DbgMemoryFlags[1];
 // 	mSize = size;
-// 
+//
 // 	if (makeCopy)
 // 	{
 // 		uint8* dataCopy = new uint8[size];
@@ -40,8 +40,8 @@ DbgModuleMemoryCache::DbgModuleMemoryCache(uintptr addr, int size)
 // 	else
 // 	{
 // 		mBlocks[0] = data;
-// 	}	
-// 
+// 	}
+//
 // 	mOwns = makeCopy;
 // 	mBlockCount = 1;
 // }
@@ -75,7 +75,7 @@ DbgMemoryFlags DbgModuleMemoryCache::Read(uintptr addr, uint8* data, int size)
 	int relAddr = (int)(addr - mAddr);
 	int blockIdx = relAddr / mBlockSize;
 	int curOffset = relAddr % mBlockSize;
-	
+
 	while (sizeLeft > 0)
 	{
 		uint8* block = mBlocks[blockIdx];
@@ -98,7 +98,7 @@ DbgMemoryFlags DbgModuleMemoryCache::Read(uintptr addr, uint8* data, int size)
 		}
 		sizeLeft -= readSize;
 		curOffset = 0;
-		blockIdx++;		
+		blockIdx++;
 	}
 
 	return flags;
@@ -114,4 +114,4 @@ void DbgModuleMemoryCache::ReportMemory(MemReporter * memReporter)
 				totalMemory += mBlockSize;
 	}
 	memReporter->Add(totalMemory);
-}
+}

+ 23 - 25
IDEHelper/Debugger.h

@@ -29,7 +29,7 @@ public:
 	int mPendingHotBindIdx;
 	int mHitCount;
 	int mTargetHitCount;
-	DbgHitCountBreakKind mHitCountBreakKind;	
+	DbgHitCountBreakKind mHitCountBreakKind;
 	String mLogging;
 	bool mBreakAfterLogging;
 
@@ -40,7 +40,7 @@ public:
 	Breakpoint* mLinkedSibling; // For things like templates with multiple imps on same source line
 	bool mIsLinkedSibling; // Not in breakpoint list
 
-public:	
+public:
 	Breakpoint()
 	{
 		mRequestedLineNum = -1;
@@ -50,11 +50,11 @@ public:
 		mPendingHotBindIdx = -1;
 		mHitCount = 0;
 		mTargetHitCount = 0;
-		mHitCountBreakKind = DbgHitCountBreakKind_None;			
+		mHitCountBreakKind = DbgHitCountBreakKind_None;
 		mThreadId = -1;
 		mHead = NULL;
 		mLinkedSibling = NULL;
-		mIsLinkedSibling = false;		
+		mIsLinkedSibling = false;
 		mBreakAfterLogging = false;
 	}
 
@@ -62,7 +62,6 @@ public:
 	virtual bool IsMemoryBreakpointBound() = 0;
 };
 
-
 enum DbgTypeKindFlags
 {
 	DbgTypeKindFlag_None = 0,
@@ -97,7 +96,7 @@ enum DwFloatDisplayType : int8
 {
 	DwFloatDisplayType_Default,
 	DwFloatDisplayType_Minimal,
-	DwFloatDisplayType_Full,	
+	DwFloatDisplayType_Full,
 	DwFloatDisplayType_HexUpper,
 
 	DwFloatDisplayType_HexLower,
@@ -126,7 +125,7 @@ enum DwEvalExpressionFlags : int16
 	DwEvalExpressionFlag_MemoryAddress = 0x40,
 	DwEvalExpressionFlag_MemoryWatch = 0x80,
 	DwEvalExpressionFlag_Symbol = 0x100,
-	DwEvalExpressionFlag_StepIntoCalls = 0x200,	
+	DwEvalExpressionFlag_StepIntoCalls = 0x200,
 	DwEvalExpressionFlag_RawStr = 0x400,
 	DwEvalExpressionFlag_AllowStringView = 0x800
 };
@@ -148,7 +147,7 @@ struct DwDisplayInfo
 
 enum RunState
 {
-	RunState_NotStarted,	
+	RunState_NotStarted,
 	RunState_Running,
 	RunState_Running_ToTempBreakpoint,
 	RunState_Paused,
@@ -158,7 +157,7 @@ enum RunState
 	RunState_HotStep,
 	RunState_Exception,
 	RunState_Terminating,
-	RunState_Terminated,	
+	RunState_Terminated,
 	RunState_SearchingSymSrv,
 	RunState_HotResolve
 };
@@ -203,16 +202,15 @@ enum DbgMemoryFlags : uint8
 class DbgModuleMemoryCache
 {
 public:
-	
 
-public:	
+public:
 	uintptr mAddr;
 	int mSize;
 	int mBlockSize;
 	uint8** mBlocks;
 	DbgMemoryFlags* mFlags;
 	int mBlockCount;
-	bool mOwns;	
+	bool mOwns;
 
 public:
 	DbgModuleMemoryCache(uintptr addr, int size);
@@ -229,7 +227,7 @@ public:
 	struct TypeData
 	{
 		intptr mCount;
-		intptr mSize;		
+		intptr mSize;
 
 		TypeData()
 		{
@@ -249,7 +247,7 @@ class Debugger
 {
 public:
 	DebugManager* mDebugManager;
-	RunState mRunState;			
+	RunState mRunState;
 	DbgHotResolveData* mHotResolveData;
 	bool mHadImageFindError;
 
@@ -257,7 +255,7 @@ public:
 	Debugger()
 	{
 		mDebugManager = NULL;
-		mRunState = RunState_NotStarted;		
+		mRunState = RunState_NotStarted;
 		mHotResolveData = NULL;
 		mHadImageFindError = false;
 	}
@@ -283,7 +281,7 @@ public:
 	virtual Breakpoint* CreateAddressBreakpoint(intptr address) = 0;
 	virtual void CheckBreakpoint(Breakpoint* breakpoint) = 0;
 	virtual void HotBindBreakpoint(Breakpoint* wdBreakpoint, int lineNum, int hotIdx) = 0;
-	virtual void DeleteBreakpoint(Breakpoint* wdBreakpoint) = 0;	
+	virtual void DeleteBreakpoint(Breakpoint* wdBreakpoint) = 0;
 	virtual void DetachBreakpoint(Breakpoint* wdBreakpoint) = 0;
 	virtual void MoveBreakpoint(Breakpoint* wdBreakpoint, int lineNum, int wantColumn, bool rebindNow) = 0;
 	virtual void MoveMemoryBreakpoint(Breakpoint* wdBreakpoint, intptr addr, int byteCount) = 0;
@@ -306,13 +304,13 @@ public:
 	virtual void EvaluateContinueKeep() = 0;
 	virtual String EvaluateToAddress(const StringImpl& expr, int callStackIdx, int cursorPos) = 0;
 	virtual String EvaluateAtAddress(const StringImpl& expr, intptr atAddr, int cursorPos) = 0;
-	virtual String GetCollectionContinuation(const StringImpl& continuationData, int callStackIdx, int count) = 0;	
+	virtual String GetCollectionContinuation(const StringImpl& continuationData, int callStackIdx, int count) = 0;
 	virtual String GetAutoExpressions(int callStackIdx, uint64 memoryRangeStart, uint64 memoryRangeLen) = 0;
 	virtual String GetAutoLocals(int callStackIdx, bool showRegs) = 0;
 	virtual String CompactChildExpression(const StringImpl& expr, const StringImpl& parentExpr, int callStackIdx) = 0;
 	virtual String GetProcessInfo() = 0;
 	virtual String GetThreadInfo() = 0;
-	virtual void SetActiveThread(int threadId) = 0;	
+	virtual void SetActiveThread(int threadId) = 0;
 	virtual int GetActiveThread() = 0;
 	virtual void FreezeThread(int threadId) = 0;
 	virtual void ThawThread(int threadId) = 0;
@@ -321,12 +319,12 @@ public:
 	virtual void UpdateCallStack(bool slowEarlyOut = true) = 0;
 	virtual int GetCallStackCount() = 0;
 	virtual int GetRequestedStackFrameIdx() = 0;
-	virtual int GetBreakStackFrameIdx() = 0;	
+	virtual int GetBreakStackFrameIdx() = 0;
 	virtual bool ReadMemory(intptr address, uint64 length, void* dest, bool local = false) = 0;
 	virtual bool WriteMemory(intptr address, void* src, uint64 length) = 0;
 	virtual DbgMemoryFlags GetMemoryFlags(intptr address) = 0;
-	virtual void UpdateRegisterUsage(int stackFrameIdx) = 0;	
-	virtual void UpdateCallStackMethod(int stackFrameIdx) = 0;	
+	virtual void UpdateRegisterUsage(int stackFrameIdx) = 0;
+	virtual void UpdateCallStackMethod(int stackFrameIdx) = 0;
 	virtual void GetCodeAddrInfo(intptr addr, intptr inlineCallAddr, String* outFile, int* outHotIdx, int* outDefLineStart, int* outDefLineEnd, int* outLine, int* outColumn) = 0;
 	virtual void GetStackAllocInfo(intptr addr, int* outThreadId, int* outStackIdx) = 0;
 	virtual String GetStackFrameInfo(int stackFrameIdx, intptr* addr, String* outFile, int32* outHotIdx, int32* outDefLineStart, int32* outDefLineEnd, int32* outLine, int32* outColumn, int32* outLanguage, int32* outStackSize, int8* outFlags) = 0;
@@ -340,8 +338,8 @@ public:
 	virtual String GetAddressSymbolName(intptr address, bool demangle) = 0;
 	virtual String DisassembleAtRaw(intptr address) = 0;
 	virtual String DisassembleAt(intptr address) = 0;
-	virtual String FindLineCallAddresses(intptr address) = 0;	
-	virtual String GetCurrentException() = 0;	
+	virtual String FindLineCallAddresses(intptr address) = 0;
+	virtual String GetCurrentException() = 0;
 	virtual String GetModulesInfo() = 0;
 	virtual void SetAliasPath(const StringImpl& origPath, const StringImpl& localPath) = 0;
 	virtual void CancelSymSrv() = 0;
@@ -351,7 +349,7 @@ public:
 	virtual int LoadDebugInfoForModule(const StringImpl& moduleName, const StringImpl& debugFileName) = 0;
 	virtual void StopDebugging() = 0;
 	virtual void Terminate() = 0;
-	virtual void Detach() = 0;	
+	virtual void Detach() = 0;
 	virtual Profiler* StartProfiling() = 0;
 	virtual Profiler* PopProfiler() = 0; // Profiler requested by target program
 	virtual void ReportMemory(MemReporter* memReporter) = 0;
@@ -380,7 +378,7 @@ public:
 	virtual bool IsSampling() = 0;
 	virtual String GetOverview() = 0;
 	virtual String GetThreadList() = 0;
-	virtual String GetCallTree(int threadId, bool reverse) = 0;	
+	virtual String GetCallTree(int threadId, bool reverse) = 0;
 };
 
 NS_BF_END

+ 3 - 3
IDEHelper/LLVMUtils.h

@@ -18,13 +18,13 @@
 NS_BF_BEGIN
 
 /// raw_null_ostream - A raw_ostream that discards all output.
-class debug_ostream : public llvm::raw_ostream 
+class debug_ostream : public llvm::raw_ostream
 {
 	/// write_impl - See raw_ostream::write_impl.
 	void write_impl(const char *Ptr, size_t size) override
 	{
 		StringT<1024> str;
-		str.Append(Ptr, size);		
+		str.Append(Ptr, size);
 		OutputDebugStr(str);
 	}
 
@@ -33,7 +33,7 @@ class debug_ostream : public llvm::raw_ostream
 	uint64_t current_pos() const override
 	{
 		return 0;
-	}	
+	}
 };
 
 NS_BF_END

+ 37 - 40
IDEHelper/NetManager.cpp

@@ -83,10 +83,10 @@ void NetRequest::Cleanup()
 {
 	if (mCURLMulti != NULL)
 		curl_multi_remove_handle(mCURLMulti, mCURL);
-	if (mCURL != NULL)	
-		curl_easy_cleanup(mCURL);		
-	if (mCURLMulti != NULL)	
-		curl_multi_cleanup(mCURLMulti);	
+	if (mCURL != NULL)
+		curl_easy_cleanup(mCURL);
+	if (mCURLMulti != NULL)
+		curl_multi_cleanup(mCURLMulti);
 
 	mCURL = NULL;
 	mCURLMulti = NULL;
@@ -160,7 +160,7 @@ void NetRequest::DoTransfer()
 		// 		mFailed = true;
 		// 		return;
 		// 	}
-		
+
 		response_code = 0;
 		curl_easy_getinfo(mCURL, CURLINFO_RESPONSE_CODE, &response_code);
 		mNetManager->mDebugManager->OutputRawMessage(StrFormat("msgLo Result for '%s': %d\n", mURL.c_str(), response_code));
@@ -199,20 +199,20 @@ void NetRequest::DoTransfer()
 	}
 
 	if (response_code != 200)
-	{		
+	{
 		mOutFile.Close();
 		// Bad result
 		mFailed = true;
 		return;
 	}
-	
+
 	BfLogDbg("NetManager successfully completed %s\n", mURL.c_str());
 
 	if (mCancelOnSuccess != NULL)
 		mNetManager->Cancel(mCancelOnSuccess);
 
 	if (!mOutFile.IsOpen())
-	{		
+	{
 		mFailed = true;
 		return; // No data
 	}
@@ -223,14 +223,14 @@ void NetRequest::DoTransfer()
 	BfpFile_Rename(mOutTempPath.c_str(), mOutPath.c_str(), &renameResult);
 
 	if (renameResult != BfpFileResult_Ok)
-	{		
-		mFailed = true;		
+	{
+		mFailed = true;
 	}
 }
 
 void NetRequest::Perform()
-{	
-	DoTransfer();	
+{
+	DoTransfer();
 }
 
 #elif defined BF_PLATFORM_WINDOWS
@@ -263,16 +263,16 @@ void NetRequest::Perform()
 		Fail("Invalid URL");
 		return;
 	}
-	
+
 	protoName = mURL.Substring(0, colonPos);
 	serverName = mURL.Substring(colonPos + 3);
-		
+
 	int slashPos = (int)serverName.IndexOf('/');
 	if (slashPos != -1)
 	{
 		objectName = serverName.Substring(slashPos);
 		serverName.RemoveToEnd(slashPos);
-	}	
+	}
 
 	mOutTempPath = mOutPath + "__partial";
 
@@ -291,8 +291,8 @@ void NetRequest::Perform()
 
 		if (mOutFile.IsOpen())
 			mOutFile.Close();
-	};	
-	
+	};
+
 	bool isHttp = protoName.Equals("http", StringImpl::CompareKind_OrdinalIgnoreCase);
 	bool isHttps = protoName.Equals("https", StringImpl::CompareKind_OrdinalIgnoreCase);
 	if ((!isHttp) && (!isHttps))
@@ -350,23 +350,23 @@ void NetRequest::Perform()
 	}
 
 	if (mShowTracking)
-	{		
+	{
 		mNetManager->mDebugManager->OutputRawMessage(StrFormat("symsrv Getting '%s'", mURL.c_str()));
 	}
 
-	uint8 buffer[4096];	
+	uint8 buffer[4096];
 	while (true)
 	{
 		DWORD dwBytesRead = 0;
 		BOOL bRead = InternetReadFile(hHttpFile, buffer, 4096, &dwBytesRead);
-		if (dwBytesRead == 0) 
+		if (dwBytesRead == 0)
 			break;
-		if (!bRead) 
+		if (!bRead)
 		{
 			//printf("InternetReadFile error : <%lu>\n", GetLastError());
 			Fail("Failed to receive");
 			return;
-		}		
+		}
 
 		if (!mOutFile.IsOpen())
 		{
@@ -378,7 +378,7 @@ void NetRequest::Perform()
 			}
 		}
 		mOutFile.Write(buffer, (int)dwBytesRead);
-	}	
+	}
 
 	BfLogDbg("NetManager successfully completed %s\n", mURL.c_str());
 
@@ -402,7 +402,6 @@ void NetRequest::Perform()
 
 void NetRequest::Cleanup()
 {
-
 }
 
 #else
@@ -414,7 +413,6 @@ void NetRequest::Perform()
 
 void NetRequest::Cleanup()
 {
-
 }
 
 #endif
@@ -437,7 +435,7 @@ NetRequest::~NetRequest()
 			delete mResult;
 	}
 
-	mNetManager->mRequestDoneEvent.Set();	
+	mNetManager->mRequestDoneEvent.Set();
 }
 
 void NetRequest::Fail(const StringImpl& error)
@@ -456,7 +454,7 @@ bool NetRequest::Cancel()
 }
 
 void NetRequest::ShowTracking()
-{	
+{
 	//mNetManager->mDebugManager->OutputMessage(StrFormat("Getting '%s'\n", mURL.c_str()));
 	mNetManager->mDebugManager->OutputRawMessage(StrFormat("symsrv Getting '%s'", mURL.c_str()));
 	mShowTracking = true;
@@ -464,7 +462,6 @@ void NetRequest::ShowTracking()
 
 void NetManagerThread()
 {
-
 }
 
 NetManager::NetManager() : mThreadPool(8, 1*1024*1024)
@@ -480,13 +477,13 @@ NetManager::~NetManager()
 	for (auto kv : mCachedResults)
 	{
 		delete kv.mValue;
-	}	
+	}
 }
 
 NetRequest* NetManager::CreateGetRequest(const StringImpl& url, const StringImpl& destPath, bool useCache)
 {
 	AutoCrit autoCrit(mThreadPool.mCritSect);
-		
+
 	NetRequest* netRequest = new NetRequest();
 	netRequest->mNetManager = this;
 	netRequest->mURL = url;
@@ -520,7 +517,7 @@ NetRequest* NetManager::CreateGetRequest(const StringImpl& url, const StringImpl
 NetResult* NetManager::QueueGet(const StringImpl& url, const StringImpl& destPath, bool useCache)
 {
 	BfLogDbg("NetManager queueing %s %d\n", url.c_str(), useCache);
-	
+
 	auto netRequest = CreateGetRequest(url, destPath, useCache);
 	auto netResult = netRequest->mResult;
 	mThreadPool.AddJob(netRequest);
@@ -528,7 +525,7 @@ NetResult* NetManager::QueueGet(const StringImpl& url, const StringImpl& destPat
 }
 
 bool NetManager::Get(const StringImpl& url, const StringImpl& destPath)
-{	
+{
 	NetRequest* netRequest = NULL;
 	int waitCount = 0;
 	while (true)
@@ -539,7 +536,7 @@ bool NetManager::Get(const StringImpl& url, const StringImpl& destPath)
 
 			mWaitingResult = NULL;
 			NetResult* netResult;
-			if (mCachedResults.TryGetValue(url, &netResult))			
+			if (mCachedResults.TryGetValue(url, &netResult))
 			{
 				if (netResult->mCurRequest == NULL)
 				{
@@ -547,7 +544,7 @@ bool NetManager::Get(const StringImpl& url, const StringImpl& destPath)
 					return (!netResult->mFailed) && (FileExists(netResult->mOutPath));
 				}
 				else if (!netResult->mCurRequest->mShowTracking) // Is done?
-				{	
+				{
 					if (!netResult->mCurRequest->mProcessing)
 					{
 						BfLogDbg("NetManager::Get pulling queued request into current thread %s\n", url.c_str());
@@ -557,9 +554,9 @@ bool NetManager::Get(const StringImpl& url, const StringImpl& destPath)
 						break;
 					}
 
-					mWaitingResult = netResult;					
+					mWaitingResult = netResult;
 					netResult->mCurRequest->ShowTracking();
-				}				
+				}
 			}
 			else
 			{
@@ -597,12 +594,12 @@ void NetManager::CancelAll()
 	AutoCrit autoCrit(mThreadPool.mCritSect);
 	if (mWaitingRequest != NULL)
 		mWaitingRequest->Cancel();
-	mThreadPool.CancelAll();	
+	mThreadPool.CancelAll();
 }
 
 void NetManager::Clear()
 {
-	AutoCrit autoCrit(mThreadPool.mCritSect);		
+	AutoCrit autoCrit(mThreadPool.mCritSect);
 	BF_ASSERT(mWaitingResult == NULL); // The debugger thread shouldn't be waiting on anything, it should be detached at this point
 
 	for (auto job : mThreadPool.mJobs)
@@ -649,7 +646,7 @@ void NetManager::SetCancelOnSuccess(NetResult* dependentResult, NetResult* cance
 {
 	AutoCrit autoCrit(mThreadPool.mCritSect);
 	if (dependentResult->mCurRequest != NULL)
-	{		
+	{
 		dependentResult->mCurRequest->mCancelOnSuccess = cancelOnSucess;
 	}
-}
+}

+ 4 - 4
IDEHelper/NetManager.h

@@ -52,10 +52,10 @@ public:
 #else
 #endif
 		mCancelling = false;
-		mFailed = false;		
+		mFailed = false;
 		mShowTracking = false;
 		mResult = NULL;
-		mCancelOnSuccess = NULL;		
+		mCancelOnSuccess = NULL;
 	}
 	~NetRequest();
 
@@ -63,7 +63,7 @@ public:
 
 	void Cleanup();
 	void Fail(const StringImpl& error);
-	bool Cancel() override;	
+	bool Cancel() override;
 	void Perform() override;
 	void ShowTracking();
 };
@@ -113,7 +113,7 @@ public:
 	NetRequest* CreateGetRequest(const StringImpl& url, const StringImpl& destPath, bool useCache);
 	NetResult* QueueGet(const StringImpl& url, const StringImpl& destPath, bool useCache);
 	bool Get(const StringImpl& url, const StringImpl& destPath);
-	
+
 	void CancelAll();
 	void Clear();
 	void CancelCurrent();

+ 2 - 2
IDEHelper/SpellChecker.cpp

@@ -26,9 +26,9 @@ BF_EXPORT SpellChecker* BF_CALLTYPE SpellChecker_Create(const char* langPath)
 		return NULL;
 	}
 
-	SpellChecker* spellChecker = new SpellChecker();	
+	SpellChecker* spellChecker = new SpellChecker();
 	spellChecker->mHunHandle = hunHandle;
-	
+
 	return spellChecker;
 }
 

+ 8 - 9
IDEHelper/StrBloomMap.h

@@ -13,7 +13,7 @@ public:
 	Beefy::BumpAllocator mAlloc;
 
 	struct Entry
-	{		
+	{
 		T mValue;
 		Entry* mNext;
 	};
@@ -30,7 +30,7 @@ public:
 		{
 			mMap = map;
 			mCurBucket = 0;
-			mCurEntry = NULL;	
+			mCurEntry = NULL;
 		}
 
 		Iterator& operator++()
@@ -67,7 +67,7 @@ public:
 
 public:
 	int GetHash(const char* str, const char* strEnd)
-	{	
+	{
 		if (str == NULL)
 			return 0;
 
@@ -83,20 +83,20 @@ public:
 		return curHash & 0x7FFFFFFF;
 	}
 
-public:	
+public:
 	Entry** mHashHeads;
 
 public:
 	StrBloomMap()
 	{
-		mHashHeads = NULL;		
+		mHashHeads = NULL;
 	}
 
 	void InsertUnique(int hash, T value)
 	{
 		if (mHashHeads == NULL)
 			mHashHeads = (Entry**)mAlloc.AllocBytes(sizeof(Entry*) * HashSize, alignof(Entry*));
-		
+
 		int hashIdx = hash % HashSize;
 		Entry* headEntry = mHashHeads[hashIdx];
 
@@ -116,12 +116,12 @@ public:
 	}
 
 	Entry* FindFirst(const char* name)
-	{		
+	{
 		if (mHashHeads == NULL)
 			return NULL;
 
 		int hash = GetHash(name, NULL) % HashSize;
-		return mHashHeads[hash];		
+		return mHashHeads[hash];
 	}
 
 	Iterator begin()
@@ -138,4 +138,3 @@ public:
 };
 
 NS_BF_DBG_END
-

+ 4 - 5
IDEHelper/StrHashMap.h

@@ -8,10 +8,10 @@ NS_BF_DBG_BEGIN
 template <typename T>
 class StrHashMap
 {
-public:	
+public:
 	struct Entry
 	{
-		T mValue;		
+		T mValue;
 		Entry* mNext;
 		int mHash;
 	};
@@ -102,7 +102,7 @@ public:
 public:
 	Beefy::BumpAllocator mAlloc;
 	Entry** mHashHeads;
-	int mHashSize;	
+	int mHashSize;
 	int mCount;
 
 public:
@@ -140,7 +140,7 @@ public:
 			Entry* checkEntry = mHashHeads[hashIdx];
 			while (checkEntry != NULL)
 			{
-				auto nextEntry = checkEntry->mNext;				
+				auto nextEntry = checkEntry->mNext;
 				int newHashIdx = checkEntry->mHash % newHashSize;
 				checkEntry->mNext = newHashHeads[newHashIdx];
 				newHashHeads[newHashIdx] = checkEntry;
@@ -197,5 +197,4 @@ public:
 	}
 };
 
-
 NS_BF_DBG_END

+ 14 - 20
IDEHelper/VSSupport.cpp

@@ -56,7 +56,7 @@
 struct Find_Result {
 	int windows_sdk_version = 0;   // Zero if no Windows SDK found.
 
-	wchar_t *windows_sdk_root = NULL;	
+	wchar_t *windows_sdk_root = NULL;
 
 	wchar_t* vs_version = NULL;
 	wchar_t *vs_exe32_path = NULL;
@@ -68,7 +68,7 @@ struct Find_Result {
 Find_Result find_visual_studio_and_windows_sdk();
 
 void free_resources(Find_Result *result) {
-	free(result->windows_sdk_root);	
+	free(result->windows_sdk_root);
 	free(result->vs_version);
 	free(result->vs_exe32_path);
 	free(result->vs_exe64_path);
@@ -95,10 +95,10 @@ void free_resources(Find_Result *result) {
 // I am not making this up: https://github.com/Microsoft/vswhere
 //
 // Several people have therefore found the need to solve this problem
-// themselves. We referred to some of these other solutions when 
+// themselves. We referred to some of these other solutions when
 // figuring out what to do, most prominently ziglang's version,
 // by Ryan Saunderson.
-// 
+//
 // I hate this kind of code. The fact that we have to do this at all
 // is stupid, and the actual maneuvers we need to go through
 // are just painful. If programming were like this all the time,
@@ -148,7 +148,6 @@ public:
 
 #define defer const auto& CONCAT(defer__, __LINE__) = ExitScopeHelp() + [&]()
 
-
 // COM objects for the ridiculous Microsoft craziness.
 
 struct DECLSPEC_UUID("B41463C3-8866-43B5-BC33-2B0676F7F42E") DECLSPEC_NOVTABLE ISetupInstance : public IUnknown
@@ -178,7 +177,6 @@ struct DECLSPEC_UUID("42843719-DB4C-46C2-8E7C-64F1816EFD5B") DECLSPEC_NOVTABLE I
 	STDMETHOD(GetInstanceForPath)(_In_z_ LPCWSTR wzPath, _Out_ ISetupInstance** ppInstance) = 0;
 };
 
-
 // The beginning of the actual code that does things.
 
 struct Version_Data {
@@ -224,7 +222,6 @@ wchar_t *concat(wchar_t *a, wchar_t *b, wchar_t *c = nullptr, wchar_t *d = nullp
 
 typedef void(*Visit_Proc_W)(wchar_t *short_name, wchar_t *full_name, Version_Data *data);
 bool visit_files_w(wchar_t *dir_name, Version_Data *data, Visit_Proc_W proc) {
-
 	// Visit everything in one folder (non-recursively). If it's a directory
 	// that doesn't start with ".", call the visit proc on it. The visit proc
 	// will see if the filename conforms to the expected versioning pattern.
@@ -253,7 +250,6 @@ bool visit_files_w(wchar_t *dir_name, Version_Data *data, Visit_Proc_W proc) {
 	return true;
 }
 
-
 wchar_t *find_windows_kit_root(HKEY key, wchar_t *version) {
 	// Given a key to an already opened registry entry,
 	// get the value stored under the 'version' subkey.
@@ -340,7 +336,7 @@ void find_windows_kit_root(Find_Result *result) {
 	// is stored in the same place in the registry. We open a key
 	// to that place, first checking preferentially for a Windows 10 kit,
 	// then, if that's not found, a Windows 8 kit.
-	
+
 	HKEY main_key;
 
 	auto rc = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots",
@@ -386,7 +382,6 @@ void find_windows_kit_root(Find_Result *result) {
 	// If we get here, we failed to find anything.
 }
 
-
 void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *result) {
 	// The name of this procedure is kind of cryptic. Its purpose is
 	// to fight through Microsoft craziness. The things that the fine
@@ -449,7 +444,7 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
 		if (!success) continue;
 
 		auto version_bytes = (tools_file_size.QuadPart + 1) * 2;  // Warning: This multiplication by 2 presumes there is no variable-length encoding in the wchars (wacky characters in the file could betray this expectation).
-		wchar_t *version = (wchar_t *)malloc(version_bytes);		
+		wchar_t *version = (wchar_t *)malloc(version_bytes);
 
 		auto read_result = fgetws(version, (int)version_bytes, f);
 		if (!read_result) continue;
@@ -465,15 +460,15 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
 
 		bool use = false;
 		if ((os_file_exists(library_file)) && (os_file_exists(vs_exe64_link_path)))
-		{			
+		{
 			if (result->vs_version == NULL)
 			{
 				use = true;
-			}			
+			}
 			else if (wcscmp(version, result->vs_version) > 0)
 			{
 				use = true;
-			}			
+			}
 		}
 
 		if (use)
@@ -492,7 +487,7 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
 			free(library32_path);
 			free(library64_path);
 		}
-		
+
 		free(library_file);
 		free(vs_exe64_link_path);
 
@@ -562,7 +557,6 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
 	// If we get here, we failed to find anything.
 }
 
-
 Find_Result find_visual_studio_and_windows_sdk() {
 	Find_Result result;
 
@@ -582,7 +576,7 @@ BF_EXPORT const char* BF_CALLTYPE VSSupport_Find()
 {
 	Beefy::String& outString = *Beefy::gTLStrReturn.Get();
 	outString.clear();
-	
+
 	Find_Result findResult = find_visual_studio_and_windows_sdk();
 
 	auto _AddPath = [&](wchar_t* str)
@@ -593,11 +587,11 @@ BF_EXPORT const char* BF_CALLTYPE VSSupport_Find()
 			outString += Beefy::UTF8Encode(str);
 		}
 	};
-	
+
 	if (findResult.vs_exe32_path != NULL)
 		outString += "TOOL32\t" + Beefy::UTF8Encode(findResult.vs_exe32_path) + "\n";
 	if (findResult.vs_exe64_path != NULL)
-		outString += "TOOL64\t" + Beefy::UTF8Encode(findResult.vs_exe64_path) + "\n";		
+		outString += "TOOL64\t" + Beefy::UTF8Encode(findResult.vs_exe64_path) + "\n";
 
 	if (findResult.windows_sdk_root != NULL)
 	{
@@ -630,7 +624,7 @@ BF_EXPORT const char* BF_CALLTYPE VSSupport_Find()
 		outString += Beefy::UTF8Encode(findResult.vs_library64_path);
 		outString += "\n";
 	}
-	
+
 	free_resources(&findResult);
 
 	return outString.c_str();

+ 36 - 37
IDEHelper/X64.cpp

@@ -54,7 +54,7 @@ const char* X64CPURegisters::sCPURegisterNames[] =
 	"NONE",
 
 	// integer general registers (DO NOT REORDER THESE; must exactly match DbgModule x86 register mappings)
-	"RAX",	
+	"RAX",
 	"RDX",
 	"RCX",
 	"RBX",
@@ -69,7 +69,7 @@ const char* X64CPURegisters::sCPURegisterNames[] =
 	"R12",
 	"R13",
 	"R14",
-	"R15",			
+	"R15",
 	"RIP",
 	"EFL",
 	"GS",
@@ -88,7 +88,7 @@ const char* X64CPURegisters::sCPURegisterNames[] =
 	"R13D",
 	"R14D",
 	"R15D",
-	
+
 	"AX",
 	"DX",
 	"CX",
@@ -141,7 +141,7 @@ const char* X64CPURegisters::sCPURegisterNames[] =
 	"MM4",
 	"MM5",
 	"MM6",
-	"MM7",	
+	"MM7",
 
 	"XMM0_f64",
 	"XMM1_f64",
@@ -354,7 +354,7 @@ bool X64Instr::IsRep(bool& isPrefixOnly)
 
 bool X64Instr::IsReturn()
 {
-	const MCInstrDesc &instDesc = mX64->mInstrInfo->get(mMCInst.getOpcode()); 
+	const MCInstrDesc &instDesc = mX64->mInstrInfo->get(mMCInst.getOpcode());
 	return (instDesc.getFlags() & (1 << MCID::Return)) != 0;
 }
 
@@ -402,7 +402,7 @@ static int ConvertRegNum(const MCOperand& operand)
 		return X64Reg_RBP;
 	case llvm::X86::RSP:
 		return X64Reg_RSP;
-	
+
 	case llvm::X86::R8:
 	case llvm::X86::R8D:
 	case llvm::X86::R8W:
@@ -507,7 +507,7 @@ static int ConvertRegNum(const MCOperand& operand)
 	case llvm::X86::XMM14:
 		return X64Reg_M128_XMM14;
 	case llvm::X86::XMM15:
-		return X64Reg_M128_XMM15;	
+		return X64Reg_M128_XMM15;
 	}
 
 	return -1;
@@ -573,13 +573,13 @@ bool X64Instr::GetImmediate(uint64* outImm)
 
 int X64Instr::GetJmpState(int flags)
 {
-	const MCInstrDesc &instDesc = mX64->mInstrInfo->get(mMCInst.getOpcode());	
+	const MCInstrDesc &instDesc = mX64->mInstrInfo->get(mMCInst.getOpcode());
 	if ((instDesc.getFlags() & (1 << MCID::Branch)) == 0)
 		return -1;
 
 	if (mMCInst.getNumOperands() < 1)
 		return 0;
-	
+
 #define FLAGVAR(abbr, name) int flag##abbr = ((flags & ((uint64)1 << X64CPURegisters::GetFlagBitForRegister(X64Reg_FLAG_##abbr##_##name))) != 0) ? 1 : 0
 	FLAGVAR(CF, CARRY);
 	FLAGVAR(PF, PARITY);
@@ -641,10 +641,10 @@ void X64Instr::MarkRegsUsed(Array<RegForm>& regsUsed, bool overrideForm)
 
 	int opCode = instDesc.getOpcode();
 	auto form = (instDesc.TSFlags & llvm::X86II::FormMask);
-	
-	/*if (opCode == 1724) 
+
+	/*if (opCode == 1724)
 	{
-		// MOVAPSrr is emitted for all moves between XMM registers, regardless of 
+		// MOVAPSrr is emitted for all moves between XMM registers, regardless of
 		//  their actual format, so we just copy the actual RegForm form here
 		if (instDesc.getNumOperands() != 2)
 			return;
@@ -655,7 +655,7 @@ void X64Instr::MarkRegsUsed(Array<RegForm>& regsUsed, bool overrideForm)
 		int regNumFrom = ConvertRegNum(operand);
 
 		if (regNumFrom == -1) // ??
-			return; 
+			return;
 
 		while (std::max(regNumFrom, regNumTo) >= (int)regsUsed.size())
 			regsUsed.push_back(RegForm_Invalid);
@@ -680,7 +680,7 @@ void X64Instr::MarkRegsUsed(Array<RegForm>& regsUsed, bool overrideForm)
 	int checkIdx = opCode * 3;
 
 	//const MCInstrDesc &instDesc = mX64->mInstrInfo->get(mMCInst.getOpcode());
-	//auto form = (instDesc.TSFlags & llvm::X86II::FormMask);	
+	//auto form = (instDesc.TSFlags & llvm::X86II::FormMask);
 
 	for (int opIdx = 0; opIdx < std::min((int)instDesc.getNumOperands(), 3); opIdx++)
 	{
@@ -696,7 +696,7 @@ void X64Instr::MarkRegsUsed(Array<RegForm>& regsUsed, bool overrideForm)
 				regsUsed[regNum] = regForm;
 
 			checkIdx++;
-		}		
+		}
 	}
 }
 
@@ -733,7 +733,7 @@ uint64 X64Instr::GetTarget(Debugger* debugger, X64CPURegisters* registers)
 
 	if (operand.isImm())
 	{
-		auto targetAddr = (uint64)operand.getImm();		
+		auto targetAddr = (uint64)operand.getImm();
 		if (instDesc.OpInfo[opIdx].OperandType == MCOI::OPERAND_PCREL)
 			targetAddr += mAddress + mSize;
 		return targetAddr;
@@ -756,10 +756,10 @@ bool X64Instr::PartialSimulate(Debugger* debugger, X64CPURegisters* registers)
 //		auto form = (instDesc.TSFlags & llvm::X86II::FormMask);
 //
 //		if ((form == llvm::X86II::MRMSrcMem) && (instDesc.NumOperands == 6))
-//		{			
+//		{
 //			auto destReg = mMCInst.getOperand(llvm::X86::AddrBaseReg);
 //			if (destReg.isReg())
-//			{				
+//			{
 //				int regNum = 0;
 //				int offset = 0;
 //				if (GetIndexRegisterAndOffset(&regNum, &offset))
@@ -767,7 +767,7 @@ bool X64Instr::PartialSimulate(Debugger* debugger, X64CPURegisters* registers)
 //					uint64 addr = registers->mIntRegsArray[regNum] + offset;
 //					uint64 val = 0;
 //					debugger->ReadMemory(addr, 8, &val);
-//					
+//
 //					switch (destReg.getReg())
 //					{
 //
@@ -779,7 +779,7 @@ bool X64Instr::PartialSimulate(Debugger* debugger, X64CPURegisters* registers)
 //// 		if ((form == llvm::X86II::MRMDestMem) || (form == llvm::X86II::MRMSrcMem) ||
 //// 			((form >= llvm::X86II::MRM0m) && (form <= llvm::X86II::MRM7m)))
 //// 		{
-//// 		}		
+//// 		}
 //	}
 //
 //	if (instDesc.getOpcode() == X86::XOR8rr)
@@ -792,7 +792,7 @@ bool X64Instr::PartialSimulate(Debugger* debugger, X64CPURegisters* registers)
 //			if ((destReg.isReg()) && (srcReg.isReg()))
 //			{
 //				if (destReg.getReg() == srcReg.getReg())
-//				{					
+//				{
 //					switch (destReg.getReg())
 //					{
 //					case X86::AL:
@@ -817,8 +817,8 @@ X64CPU::X64CPU() :
 	mInstrInfo = NULL;
 	mInstPrinter = NULL;
 
-	//InitializeAllTargets();		
-	
+	//InitializeAllTargets();
+
 	auto& TheX86_64Target = llvm::getTheX86_64Target();
 
 	const char* triple = "x86_64-pc-mingw32";
@@ -835,7 +835,7 @@ X64CPU::X64CPU() :
 		return;
 
 	mInstrInfo = TheX86_64Target.createMCInstrInfo();
-	
+
 	mMCContext = new MCContext(Triple(triple), mAsmInfo, mRegisterInfo, mSubtargetInfo);
 
 	mMCObjectFileInfo = TheX86_64Target.createMCObjectFileInfo(*mMCContext, false);
@@ -875,11 +875,11 @@ X64CPU::~X64CPU()
 }
 
 bool X64CPU::Decode(uint64 address, DbgModuleMemoryCache* memoryCache, X64Instr* inst)
-{	
+{
 	inst->mAddress = address;
 	inst->mX64 = this;
 
-	uint64 size = 0;		
+	uint64 size = 0;
 	uint8 data[15];
 	memoryCache->Read(address, data, 15);
 
@@ -939,7 +939,6 @@ void X64CPU::GetNextPC(uint64 baseAddress, const uint8* dataBase, int dataLength
 	mDisAsm->CommentStream = &nulls();
 	ArrayRef<uint8_t> dataArrayRef(dataPtr, dataLength - (dataPtr - dataBase));
 	MCDisassembler::DecodeStatus S = mDisAsm->getInstruction(mcInst, size, dataArrayRef, address, nulls());
-
 }
 
 bool X64CPU::IsReturnInstruction(X64Instr* inst)
@@ -957,7 +956,7 @@ String X64CPU::InstructionToString(X64Instr* inst, uint64 addr)
 	//mInstPrinter->CurPCRelImmOffset = addr + inst->GetLength();
 	mInstPrinter->printInst(&inst->mMCInst, addr, annotationsStr, *mSubtargetInfo, OS);
 	//OS.flush();
-	//llvm::StringRef str = OS.str();	
+	//llvm::StringRef str = OS.str();
 
 	String result;
 	for (int idx = 0; idx < (int)insnStr.size(); idx++)
@@ -991,21 +990,21 @@ String X64CPU::InstructionToString(X64Instr* inst, uint64 addr)
 }
 
 DbgBreakKind X64CPU::GetDbgBreakKind(uint64 address, DbgModuleMemoryCache* memoryCache, int64* regs, int64* outObjectPtr)
-{	
+{
 	// We've looking for a CMP BYTE PTR [<reg>], -0x80
 	//  if <reg> is R12 then encoding takes an extra 2 bytes
-	X64Instr inst;	
+	X64Instr inst;
 	for (int checkLen = 5; checkLen >= 3; checkLen--)
-	{		
+	{
 		int offset = -3 - checkLen;
 
 		if (!Decode(address + offset, memoryCache, &inst))
-			continue;	
+			continue;
 
 		if (inst.GetLength() != checkLen)
 			continue;
 
-		const MCInstrDesc &instDesc = mInstrInfo->get(inst.mMCInst.getOpcode());		
+		const MCInstrDesc &instDesc = mInstrInfo->get(inst.mMCInst.getOpcode());
 		if (!instDesc.isCompare())
 			continue;
 
@@ -1052,18 +1051,18 @@ DbgBreakKind X64CPU::GetDbgBreakKind(uint64 address, DbgModuleMemoryCache* memor
 	for (int offset = 3; offset <= 3; offset++)
 	{
 		if (!Decode(address - offset, memoryCache, &inst))
-			continue;	
+			continue;
 
 		if (inst.GetLength() != 2)
 			continue;
 
-		const MCInstrDesc &instDesc = mInstrInfo->get(inst.mMCInst.getOpcode());		
+		const MCInstrDesc &instDesc = mInstrInfo->get(inst.mMCInst.getOpcode());
 		if (!instDesc.isBranch())
 			continue;
 
 		auto immediateType = (instDesc.TSFlags & llvm::X86II::ImmMask);
 		if ((immediateType == llvm::X86II::Imm8PCRel) && (inst.mMCInst.getNumOperands() == 2))
-		{			
+		{
 			auto immOp = inst.mMCInst.getOperand(1);
 			if (!immOp.isImm())
 				continue;
@@ -1181,4 +1180,4 @@ bool X64CPU::ParseInlineAsmInstructionLLVM(const StringImpl&asmInst, String& out
 										//outError = StrFormat("%s: \"%s\"", diagMessage.c_str(), diagLineContents.c_str());
 
 	return result;
-}
+}

+ 10 - 11
IDEHelper/X64.h

@@ -36,7 +36,7 @@ enum X64CPURegister
 	X64Reg_None = -1,
 
 	// integer general registers (DO NOT REORDER THESE; must exactly match DbgModule X64 register mappings)
-	X64Reg_RAX = 0,	
+	X64Reg_RAX = 0,
 	X64Reg_RDX,
 	X64Reg_RCX,
 	X64Reg_RBX,
@@ -51,7 +51,7 @@ enum X64CPURegister
 	X64Reg_R12,
 	X64Reg_R13,
 	X64Reg_R14,
-	X64Reg_R15,	
+	X64Reg_R15,
 	X64Reg_RIP,
 	X64Reg_EFL,
 	X64Reg_GS,
@@ -74,7 +74,7 @@ enum X64CPURegister
 	X64Reg_AX,
 	X64Reg_DX,
 	X64Reg_CX,
-	X64Reg_BX,	
+	X64Reg_BX,
 	X64Reg_SI,
 	X64Reg_DI,
 	X64Reg_R8W,
@@ -93,7 +93,7 @@ enum X64CPURegister
 	X64Reg_AH,
 	X64Reg_DH,
 	X64Reg_CH,
-	X64Reg_BH,	
+	X64Reg_BH,
 	X64Reg_SIL,
 	X64Reg_DIL,
 	X64Reg_R8B,
@@ -159,7 +159,7 @@ enum X64CPURegister
 	X64Reg_XMM12_f32,
 	X64Reg_XMM13_f32,
 	X64Reg_XMM14_f32,
-	X64Reg_XMM15_f32,	
+	X64Reg_XMM15_f32,
 
 	// xmm registers
 	X64Reg_XMM00,
@@ -298,14 +298,14 @@ public:
 
 	struct IntRegs
 	{
-		int64 rax;				
+		int64 rax;
 		int64 rdx;
 		int64 rcx;
-		int64 rbx;				
+		int64 rbx;
 		int64 rsi;
 		int64 rdi;
 		uint64 rbp;
-		uint64 rsp;	
+		uint64 rsp;
 		int64 r8;
 		int64 r9;
 		int64 r10;
@@ -395,7 +395,7 @@ public:
 				X64Reg_RSP,
 				X64Reg_RBP,
 				X64Reg_RSI,
-				X64Reg_RDI,								
+				X64Reg_RDI,
 				X64Reg_R8,
 				X64Reg_R9,
 				X64Reg_R10,
@@ -466,7 +466,7 @@ public:
 	bool IsCall();
 	bool IsRep(bool& isPrefixOnly);
 	bool IsReturn();
-	bool IsLoadAddress();	
+	bool IsLoadAddress();
 	bool GetIndexRegisterAndOffset(int* outRegister, int* outOffset); // IE: [ebp + 0x4]
 	bool GetImmediate(uint64* outImm);
 	int GetJmpState(int flags);
@@ -476,7 +476,6 @@ public:
 	bool PartialSimulate(Debugger* debugger, X64CPURegisters* registers);
 };
 
-
 class X64CPU
 {
 public:

+ 41 - 42
IDEHelper/X86.cpp

@@ -159,10 +159,10 @@ bool X86Instr::StackAdjust(uint32& adjust)
 
 	if (mMCInst.getOpcode() != X86::SUB32ri8)
 		return true;
-	
+
 	auto operand0 = mMCInst.getOperand(0);
 	if (operand0.getReg() != llvm::X86::ESP)
-		return true;	
+		return true;
 	auto operand2 = mMCInst.getOperand(2);
 	if (!operand2.isImm())
 		return false;
@@ -191,7 +191,7 @@ bool X86Instr::IsReturn()
 }
 
 bool X86Instr::IsRep(bool& isPrefixOnly)
-{		
+{
 	auto instFlags = mMCInst.getFlags();
 	if ((instFlags & (X86::IP_HAS_REPEAT_NE | X86::IP_HAS_REPEAT)) != 0)
 	{
@@ -208,7 +208,7 @@ bool X86Instr::IsRep(bool& isPrefixOnly)
 }
 
 bool X86Instr::IsLoadAddress()
-{	
+{
 	const MCInstrDesc &instDesc = mX86->mInstrInfo->get(mMCInst.getOpcode());
 	if (instDesc.NumOperands >= 6)
 	{
@@ -234,25 +234,25 @@ static int ConvertRegNum(const MCOperand& operand)
 	case llvm::X86::CL:
 	case llvm::X86::CH:
 	case llvm::X86::ECX:
-		return X86Reg_ECX;		
+		return X86Reg_ECX;
 	case llvm::X86::DL:
 	case llvm::X86::DH:
 	case llvm::X86::EDX:
-		return X86Reg_EDX;		
+		return X86Reg_EDX;
 	case llvm::X86::BL:
 	case llvm::X86::BH:
 	case llvm::X86::EBX:
-		return X86Reg_EBX;		
+		return X86Reg_EBX;
 	case llvm::X86::ESP:
-		return X86Reg_ESP;		
+		return X86Reg_ESP;
 	case llvm::X86::EBP:
-		return X86Reg_EBP;		
+		return X86Reg_EBP;
 	case llvm::X86::ESI:
-		return X86Reg_ESI;		
+		return X86Reg_ESI;
 	case llvm::X86::EDI:
-		return X86Reg_EDI;		
+		return X86Reg_EDI;
 	case llvm::X86::EIP:
-		return X86Reg_EIP;		
+		return X86Reg_EIP;
 	case llvm::X86::EFLAGS:
 		return X86Reg_EFL;
 
@@ -272,7 +272,7 @@ static int ConvertRegNum(const MCOperand& operand)
 		return X86Reg_FPST6;
 	case llvm::X86::ST7:
 		return X86Reg_FPST7;
-			
+
 	case llvm::X86::XMM0:
 		return X86Reg_M128_XMM0;
 	case llvm::X86::XMM1:
@@ -299,9 +299,9 @@ bool X86Instr::GetIndexRegisterAndOffset(int* outRegister, int* outOffset)
 	const MCInstrDesc &instDesc = mX86->mInstrInfo->get(mMCInst.getOpcode());
 
 	auto form = (instDesc.TSFlags & llvm::X86II::FormMask);
-	if ((form == llvm::X86II::MRMDestMem) || (form == llvm::X86II::MRMSrcMem) || 
+	if ((form == llvm::X86II::MRMDestMem) || (form == llvm::X86II::MRMSrcMem) ||
 		((form >= llvm::X86II::MRM0m) && (form <= llvm::X86II::MRM7m)))
-	{		
+	{
 		auto baseReg = mMCInst.getOperand(llvm::X86::AddrBaseReg);
 		auto scaleAmt = mMCInst.getOperand(llvm::X86::AddrScaleAmt);
 		auto indexReg = mMCInst.getOperand(llvm::X86::AddrIndexReg);
@@ -320,12 +320,12 @@ bool X86Instr::GetIndexRegisterAndOffset(int* outRegister, int* outOffset)
 		if ((baseReg.isReg()) &&
 			(scaleAmt.isImm()) && (scaleAmt.getImm() == 1) &&
 			(indexReg.isReg()) && (indexReg.getReg() == llvm::X86::NoRegister) &&
-			(addrDisp.isImm()))		
+			(addrDisp.isImm()))
 		{
 			int regNum = ConvertRegNum(baseReg);
 			if (regNum == -1)
 				return false;
-			*outRegister = regNum;			
+			*outRegister = regNum;
 			*outOffset = (int)addrDisp.getImm();
 			return true;
 		}
@@ -336,11 +336,11 @@ bool X86Instr::GetIndexRegisterAndOffset(int* outRegister, int* outOffset)
 bool X86Instr::GetImmediate(uint32* outImm)
 {
 	const MCInstrDesc &instDesc = mX86->mInstrInfo->get(mMCInst.getOpcode());
-	
+
 	auto immediateType = (instDesc.TSFlags & llvm::X86II::ImmMask);
 	if ((immediateType == 0) && (mMCInst.getNumOperands() < 6))
 		return false;
-	
+
 	auto immOp = mMCInst.getOperand(5);
 	if (!immOp.isImm())
 		return false;
@@ -376,9 +376,9 @@ void X86Instr::MarkRegsUsed(Array<RegForm>& regsUsed, bool overrideForm)
 }
 
 uint32 X86Instr::GetTarget(Debugger* debugger, X86CPURegisters* registers)
-{	
+{
 	const MCInstrDesc &instDesc = mX86->mInstrInfo->get(mMCInst.getOpcode());
-	
+
 	if (mMCInst.getNumOperands() < 1)
 		return 0;
 
@@ -389,7 +389,7 @@ uint32 X86Instr::GetTarget(Debugger* debugger, X86CPURegisters* registers)
 		opIdx = 4;
 		operand = mMCInst.getOperand(opIdx);
 	}
-	
+
 	if (operand.isImm())
 	{
 		auto targetAddr = (uint32)operand.getImm();
@@ -418,7 +418,7 @@ X86CPU::X86CPU() :
 	mInstrInfo = NULL;
 	mInstPrinter = NULL;
 
-	//InitializeAllTargets();		
+	//InitializeAllTargets();
 
 	auto& TheX86_32Target = getTheX86_32Target();
 
@@ -438,7 +438,7 @@ X86CPU::X86CPU() :
 	//TargetOptions targetOptions;
 	//TargetMachine* targetMachine = TheX86_32Target.createTargetMachine(triple, "x86", "", targetOptions);
 
-	//const MCInstrInfo* MII = targetMachine->getSubtargetImpl()->getInstrInfo();	
+	//const MCInstrInfo* MII = targetMachine->getSubtargetImpl()->getInstrInfo();
 	//STI->getIntr
 
 	mInstrInfo = TheX86_32Target.createMCInstrInfo();
@@ -452,11 +452,11 @@ X86CPU::X86CPU() :
 	mMCContext->setObjectFileInfo(mMCObjectFileInfo);
 
 	MCDisassembler *disAsm = TheX86_32Target.createMCDisassembler(*mSubtargetInfo, *mMCContext);
-	mDisAsm = disAsm;	
+	mDisAsm = disAsm;
 
 	//TODO: LLVM3.8 - changed params
 	/*mInstPrinter = TheX86_32Target.createMCInstPrinter(1, *mAsmInfo,
-		*mInstrInfo, *mRegisterInfo, *mSubtargetInfo);*/	
+		*mInstrInfo, *mRegisterInfo, *mSubtargetInfo);*/
 	mInstPrinter = TheX86_32Target.createMCInstPrinter(Triple(triple), 1, *mAsmInfo,
 		*mInstrInfo, *mRegisterInfo);
 
@@ -471,7 +471,7 @@ X86CPU::X86CPU() :
 extern "C" void LLVMShutdown();
 
 X86CPU::~X86CPU()
-{	
+{
 	delete mInstPrinter;
 	delete mDisAsm;
 	delete mMCContext;
@@ -485,11 +485,11 @@ X86CPU::~X86CPU()
 }
 
 bool X86CPU::Decode(uint32 address, DbgModuleMemoryCache* memoryCache, X86Instr* inst)
-{	
+{
 	inst->mAddress = address;
 	inst->mX86 = this;
 
-	uint64 size = 0;		
+	uint64 size = 0;
 	uint8 data[15];
 	memoryCache->Read(address, data, 15);
 
@@ -504,15 +504,15 @@ bool X86CPU::Decode(uint32 address, DbgModuleMemoryCache* memoryCache, X86Instr*
 bool X86CPU::Decode(uint32 baseAddress, const uint8* dataBase, int dataLength, const uint8* dataPtr, X86Instr* inst)
 {
 	//X86GenericDisassembler assembler;
-		
+
 	//DisasmMemoryObject region((uint8*)dataBase, dataLength, baseAddress);
 	//std::memorystream
-	
+
 	uint32 address = baseAddress + (uint32)(dataPtr - dataBase);
 	inst->mAddress = address;
 	inst->mX86 = this;
 
-	uint64 size = 0;	
+	uint64 size = 0;
 	//TODO: LLVM3.8
 	//MCDisassembler::DecodeStatus S = mDisAsm->getInstruction(inst->mMCInst, size, region, address, nulls(), inst->mAnnotationStream);
 
@@ -526,7 +526,7 @@ bool X86CPU::Decode(uint32 baseAddress, const uint8* dataBase, int dataLength, c
 
 void X86CPU::GetNextPC(uint32 baseAddress, const uint8* dataBase, int dataLength, const uint8* dataPtr, uint32* regs, uint32 nextPCs[2])
 {
-	//DisasmMemoryObject region((uint8*) dataBase, dataLength, baseAddress);	
+	//DisasmMemoryObject region((uint8*) dataBase, dataLength, baseAddress);
 	uint32 address = baseAddress + (uint32)(dataPtr - dataBase);
 
 	uint64 size = 0;
@@ -535,17 +535,16 @@ void X86CPU::GetNextPC(uint32 baseAddress, const uint8* dataBase, int dataLength
 	mDisAsm->CommentStream = &nulls();
 	ArrayRef<uint8_t> dataArrayRef(dataPtr, dataLength - (dataPtr - dataBase));
 	MCDisassembler::DecodeStatus S = mDisAsm->getInstruction(mcInst, size, dataArrayRef, address, nulls());
-	
 }
 
 bool X86CPU::IsReturnInstruction(X86Instr* inst)
 {
 	const MCInstrDesc &instDesc = mInstrInfo->get(inst->mMCInst.getOpcode());
-	return (instDesc.getFlags() & (1<<MCID::Return)) != 0;	
+	return (instDesc.getFlags() & (1<<MCID::Return)) != 0;
 }
 
 String X86CPU::InstructionToString(X86Instr* inst, uint32 addr)
-{		
+{
 	StringRef annotationsStr;
 
 	SmallVector<char, 256> insnStr;
@@ -553,8 +552,8 @@ String X86CPU::InstructionToString(X86Instr* inst, uint32 addr)
 	//mInstPrinter->CurPCRelImmOffset = addr + inst->GetLength();
 	mInstPrinter->printInst(&inst->mMCInst, addr, annotationsStr, *mSubtargetInfo, OS);
 	//OS.flush();
-	//llvm::StringRef str = OS.str();	
-	
+	//llvm::StringRef str = OS.str();
+
 	String result;
 	for (int idx = 0; idx < (int)insnStr.size(); idx++)
 	{
@@ -570,8 +569,8 @@ String X86CPU::InstructionToString(X86Instr* inst, uint32 addr)
 		else
 			result.Append(c);
 	}
-	
-	/*String result = String(insnStr.data(), insnStr.size());	
+
+	/*String result = String(insnStr.data(), insnStr.size());
 	for (int i = 0; i < (int)result.length(); i++)
 	{
 		if (result[i] == '\t')
@@ -671,12 +670,12 @@ int X86CPU::GetOpcodesForMnemonic(const StringImpl& mnemonic, Array<int>& outOpc
 	String s(mnemonic);
 	std::transform(s.begin(), s.end(), s.begin(), ::tolower);
 	std::pair<StringToOpcodeMap::iterator, StringToOpcodeMap::iterator> range = mStringToOpcodeMap.equal_range(s);
-		
+
 	outOpcodes.Clear();
 	for (StringToOpcodeMap::iterator it = range.first; it != range.second; ++it)
 		outOpcodes.push_back(it->second);
 
-	return (int)outOpcodes.size();	
+	return (int)outOpcodes.size();
 }
 
 void X86CPU::GetClobbersForMnemonic(const StringImpl& mnemonic, int argCount, Array<int>& outImplicitClobberRegNums, int& outClobberArgCount, bool& outMayClobberMem)

+ 4 - 4
IDEHelper/X86.h

@@ -193,7 +193,7 @@ public:
 	struct XmmDReg
 	{
 		double d[2];
-	};	
+	};
 
 	struct XmmI32Reg
 	{
@@ -289,7 +289,7 @@ public:
 	llvm::raw_svector_ostream mAnnotationStream;
 	static uint8 sRegForm[];
 
-	X86Instr() : 
+	X86Instr() :
 		mAnnotationStream(mAnnotationStr)
 	{
 		mX86 = NULL;
@@ -297,7 +297,7 @@ public:
 		mSize = 0;
 	}
 
-	int GetLength();	
+	int GetLength();
 	bool StackAdjust(uint32& adjust);
 	bool IsBranch();
 	bool IsCall();
@@ -340,7 +340,7 @@ public:
 	bool Decode(uint32 baseAddress, const uint8* dataBase, int dataLength, const uint8* dataPtr, X86Instr* inst);
 	uint32 DecodeThunk(uint32 address, DbgModuleMemoryCache* memoryCache) { return 0; }
 
-	bool IsReturnInstruction(X86Instr* inst);	
+	bool IsReturnInstruction(X86Instr* inst);
 	String InstructionToString(X86Instr* inst, uint32 addr);
 
 	void GetNextPC(uint32 baseAddress, const uint8* dataBase, int dataLength, const uint8* dataPtr, uint32* regs, uint32 nextPCs[2]);

+ 1 - 1
IDEHelper/X86Target.cpp

@@ -103,4 +103,4 @@ X86Target::~X86Target()
 {
 	delete mX86CPU;
 	delete mX64CPU;
-}
+}

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini