阶段 2 完成
This commit is contained in:
@@ -190,6 +190,10 @@ class BaseGenMixin:
|
||||
return ir.IntType(32)
|
||||
if hasattr(Entry, 'IsExceptionClass') and Entry.IsExceptionClass:
|
||||
return ir.IntType(32)
|
||||
if hasattr(Entry, 'IsFunction') and Entry.IsFunction:
|
||||
return ir.PointerType(ir.IntType(8))
|
||||
if hasattr(Entry, 'IsVariable') and Entry.IsVariable:
|
||||
return ir.PointerType(ir.IntType(8))
|
||||
if hasattr(Entry, 'BaseType'):
|
||||
from lib.includes import t as _t
|
||||
if isinstance(Entry.BaseType, type) and issubclass(Entry.BaseType, _t.CEnum):
|
||||
|
||||
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
import ast
|
||||
import os
|
||||
import llvmlite.ir as ir
|
||||
from lib.core.Handles.HandlesBase import CTypeInfo
|
||||
|
||||
|
||||
class FuncGenMixin:
|
||||
@@ -9,6 +10,9 @@ class FuncGenMixin:
|
||||
def setup_from_symbol_table(self, SymbolTable):
|
||||
self.SymbolTable = SymbolTable
|
||||
for name, info in SymbolTable.items():
|
||||
if isinstance(info, CTypeInfo):
|
||||
# CTypeInfo 对象:struct/union 由 StructGen 处理,此处只处理 dict 格式
|
||||
continue
|
||||
if not isinstance(info, dict):
|
||||
if hasattr(info, 'get'):
|
||||
info = dict(info) if hasattr(info, '__iter__') else {}
|
||||
@@ -25,7 +29,7 @@ class FuncGenMixin:
|
||||
if isinstance(MemberInfo, dict):
|
||||
MemberType = self._type_str_to_llvm(MemberInfo.get('type', 'int'), MemberInfo.get('IsPtr', False))
|
||||
self.class_members[ClassName].append((MemberName, MemberType))
|
||||
elif isinstance(MemberInfo, _CTypeInfo):
|
||||
elif isinstance(MemberInfo, CTypeInfo):
|
||||
MemberType = self._ctype_to_llvm(MemberInfo)
|
||||
if MemberType is None:
|
||||
MemberType = self._type_str_to_llvm(MemberInfo.ToString(), MemberInfo.IsPtr)
|
||||
|
||||
Reference in New Issue
Block a user