MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / GetVarInfo

Function GetVarInfo

BaseTools/Source/Python/Ecc/c.py:1063–1241  ·  view source on GitHub ↗
(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetType=None, StarList=None)

Source from the content-addressed store, hash-verified

1061 return Type
1062
1063def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetType=None, StarList=None):
1064
1065 PredVar = PredVarList[0]
1066 FileID = GetTableID(FullFileName)
1067
1068 Db = GetDB()
1069 FileTable = 'Identifier' + str(FileID)
1070 # search variable in include files
1071
1072 # it is a function call, search function declarations and definitions
1073 if IsFuncCall:
1074 SqlStatement = """ select Modifier, ID
1075 from %s
1076 where Model = %d and Value = \'%s\'
1077 """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION, PredVar)
1078 ResultSet = Db.TblFile.Exec(SqlStatement)
1079
1080 for Result in ResultSet:
1081 Type = GetDataTypeFromModifier(Result[0]).split()[-1]
1082 TypedefDict = GetTypedefDict(FullFileName)
1083 Type = GetRealType(Type, TypedefDict, TargetType)
1084 return Type
1085
1086 IncludeFileList = GetAllIncludeFiles(FullFileName)
1087 for F in IncludeFileList:
1088 FileID = GetTableID(F)
1089 if FileID < 0:
1090 continue
1091
1092 FileTable = 'Identifier' + str(FileID)
1093 SqlStatement = """ select Modifier, ID
1094 from %s
1095 where Model = %d and Value = \'%s\'
1096 """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION, PredVar)
1097 ResultSet = Db.TblFile.Exec(SqlStatement)
1098
1099 for Result in ResultSet:
1100 Type = GetDataTypeFromModifier(Result[0]).split()[-1]
1101 TypedefDict = GetTypedefDict(FullFileName)
1102 Type = GetRealType(Type, TypedefDict, TargetType)
1103 return Type
1104
1105 FileID = GetTableID(FullFileName)
1106 SqlStatement = """ select Modifier, ID
1107 from Function
1108 where BelongsToFile = %d and Name = \'%s\'
1109 """ % (FileID, PredVar)
1110 ResultSet = Db.TblFile.Exec(SqlStatement)
1111
1112 for Result in ResultSet:
1113 Type = GetDataTypeFromModifier(Result[0]).split()[-1]
1114 TypedefDict = GetTypedefDict(FullFileName)
1115 Type = GetRealType(Type, TypedefDict, TargetType)
1116 return Type
1117
1118 for F in IncludeFileList:
1119 FileID = GetTableID(F)
1120 if FileID < 0:

Callers 3

Calls 10

GetTableIDFunction · 0.85
GetDataTypeFromModifierFunction · 0.85
GetTypedefDictFunction · 0.85
GetRealTypeFunction · 0.85
lenFunction · 0.85
GetTypeInfoFunction · 0.85
GetDBFunction · 0.70
GetAllIncludeFilesFunction · 0.70
GetParamListFunction · 0.70
ExecMethod · 0.45

Tested by

no test coverage detected