| changeset 3 | ebe3f8f03b59 |
| parent 0 | 638b9c697799 |
| child 12 | a0eee409ff14 |
| 2:0cb2248d0edc | 3:ebe3f8f03b59 |
|---|---|
820 { |
820 { |
821 if ( !cfilefound[i] && !bfilefound[i] ) |
821 if ( !cfilefound[i] && !bfilefound[i] ) |
822 { |
822 { |
823 // Serious problem, the analysed file is not in the GCCXML output |
823 // Serious problem, the analysed file is not in the GCCXML output |
824 iReport.addIssue(fileit->first,"", EIssueIdentityFile, EIssueTypeEmpty, |
824 iReport.addIssue(fileit->first,"", EIssueIdentityFile, EIssueTypeEmpty, |
825 BCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), SCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), "", 0, fileit->second, ""); |
825 BCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), SCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), "", 0, "",fileit->second, ""); |
826 } |
826 } |
827 else if ( !bfilefound[i] ) |
827 else if ( !bfilefound[i] ) |
828 { |
828 { |
829 // Serious problem, the analysed file is not in the GCCXML output |
829 // Serious problem, the analysed file is not in the GCCXML output |
830 iReport.addIssue(fileit->first,"", EIssueIdentityFile, EIssueTypeEmpty, |
830 iReport.addIssue(fileit->first,"", EIssueIdentityFile, EIssueTypeEmpty, |
831 BCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), SCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), "", 0, fileit->second, ""); |
831 BCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), SCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), "", 0, "",fileit->second, ""); |
832 } |
832 } |
833 else if ( !cfilefound[i]) |
833 else if ( !cfilefound[i]) |
834 { |
834 { |
835 // Serious problem, the analysed file is not in the GCCXML output |
835 // Serious problem, the analysed file is not in the GCCXML output |
836 iReport.addIssue(fileit->first,"", EIssueIdentityFile, EIssueTypeEmpty, |
836 iReport.addIssue(fileit->first,"", EIssueIdentityFile, EIssueTypeEmpty, |
837 BCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), SCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), "", 0, fileit->second, "",false); |
837 BCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), SCseverityAccessible<EIssueIdentityFile,EIssueTypeEmpty>(true), "", 0, "",fileit->second, ""); |
838 } |
838 } |
839 } |
839 } |
840 |
840 |
841 //baselineit.iNodeIndex.DumpTables(); |
841 //baselineit.iNodeIndex.DumpTables(); |
842 //currentit.iNodeIndex.DumpTables(); |
842 //currentit.iNodeIndex.DumpTables(); |
924 Equals(baseline->getNodeName(), current->getNodeName()) |
924 Equals(baseline->getNodeName(), current->getNodeName()) |
925 ); |
925 ); |
926 |
926 |
927 if (report) |
927 if (report) |
928 { |
928 { |
929 AddIssue<EIssueIdentityFile, EIssueTypeUnderConstruction>(&baseline, baseline,0); |
929 AddIssue<EIssueIdentityFile, EIssueTypeUnderConstruction>(&baseline, baseline,0,""); |
930 } |
930 } |
931 return 1; |
931 return 1; |
932 } |
932 } |
933 |
933 |
934 |
934 |
937 // |
937 // |
938 // ---------------------------------------------------------------------------- |
938 // ---------------------------------------------------------------------------- |
939 // |
939 // |
940 int UnderConstructionNodeAnalysis::FindNodeAndAnalyse(HANodeIterator baseline,HANodeIterator current) |
940 int UnderConstructionNodeAnalysis::FindNodeAndAnalyse(HANodeIterator baseline,HANodeIterator current) |
941 { |
941 { |
942 AddIssue<EIssueIdentityFile,EIssueTypeUnderConstruction>(&baseline,baseline,0); |
942 AddIssue<EIssueIdentityFile,EIssueTypeUnderConstruction>(&baseline,baseline,0,""); |
943 return 1; |
943 return 1; |
944 } |
944 } |
945 //////////////////////////////////////////////////////////////////////////////////////// |
945 //////////////////////////////////////////////////////////////////////////////////////// |
946 ///////////////////////////////VariableNodeAnalysis///////////////////////////////////// |
946 ///////////////////////////////VariableNodeAnalysis///////////////////////////////////// |
947 |
947 |
962 int VariableNodeAnalysis::FindNodeAndAnalyse(HANodeIterator baseline,HANodeIterator current) |
962 int VariableNodeAnalysis::FindNodeAndAnalyse(HANodeIterator baseline,HANodeIterator current) |
963 { |
963 { |
964 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
964 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
965 if ( !node ) |
965 if ( !node ) |
966 { |
966 { |
967 AddIssue<EIssueIdentityVariable, EIssueTypeRemoval>(&baseline, baseline,0); |
967 AddIssue<EIssueIdentityVariable, EIssueTypeRemoval>(&baseline, baseline,0,""); |
968 return 1; |
968 return 1; |
969 } |
969 } |
970 current.current = node; |
970 current.current = node; |
971 |
971 |
972 return this->Analyse(baseline,current); |
972 return this->Analyse(baseline,current); |
985 ); |
985 ); |
986 |
986 |
987 int ret = 0; |
987 int ret = 0; |
988 |
988 |
989 int lineNo = 0; |
989 int lineNo = 0; |
990 string issueLoc; |
|
990 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
991 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
991 lineNo = atoi(toString(lineNumber).c_str()); |
992 lineNo = atoi(toString(lineNumber).c_str()); |
993 const XMLCh* fnameNode= current.GetAttribute(KXMLFileIdString); |
|
994 if( fnameNode!= NULL) |
|
995 { |
|
996 HANodeIterator fileNode(current); |
|
997 bool ret1 = fileNode.FindNodeById(fnameNode); |
|
998 issueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
999 } |
|
992 |
1000 |
993 if ( IsAnonymousType(baseline) ) |
1001 if ( IsAnonymousType(baseline) ) |
994 { |
1002 { |
995 //We need to to comparison between the baseline type and current type anonymously |
1003 //We need to to comparison between the baseline type and current type anonymously |
996 |
1004 |
1016 |
1024 |
1017 if ( !ret2 || !baselinetypeanonit.IsSameNodeType(currenttypeanonit) ) |
1025 if ( !ret2 || !baselinetypeanonit.IsSameNodeType(currenttypeanonit) ) |
1018 { |
1026 { |
1019 if (report) |
1027 if (report) |
1020 { |
1028 { |
1021 AddIssue<EIssueIdentityVariable, EIssueTypeChangeInType>(&baseline, current,lineNo); |
1029 AddIssue<EIssueIdentityVariable, EIssueTypeChangeInType>(&baseline, current,lineNo,issueLoc); |
1022 } |
1030 } |
1023 ++ret; |
1031 ++ret; |
1024 } |
1032 } |
1025 else |
1033 else |
1026 { |
1034 { |
1030 int ret = analyser->Analyse(baselinetypeanonit,currenttypeanonit,false); |
1038 int ret = analyser->Analyse(baselinetypeanonit,currenttypeanonit,false); |
1031 if ( ret > 0 ) |
1039 if ( ret > 0 ) |
1032 { |
1040 { |
1033 if (report) |
1041 if (report) |
1034 { |
1042 { |
1035 AddIssue<EIssueIdentityVariable, EIssueTypeChangeInType>(&baseline, current,lineNo); |
1043 AddIssue<EIssueIdentityVariable, EIssueTypeChangeInType>(&baseline, current,lineNo,issueLoc); |
1036 } |
1044 } |
1037 ++ret; |
1045 ++ret; |
1038 } |
1046 } |
1039 delete analyser; |
1047 delete analyser; |
1040 } |
1048 } |
1044 //{KXMLTypeString,EIdAttribute} |
1052 //{KXMLTypeString,EIdAttribute} |
1045 if ( !CompareAttributes(baseline,current,KXMLTypeString,ETypeAttribute) ) |
1053 if ( !CompareAttributes(baseline,current,KXMLTypeString,ETypeAttribute) ) |
1046 { |
1054 { |
1047 if (report) |
1055 if (report) |
1048 { |
1056 { |
1049 AddIssue<EIssueIdentityVariable, EIssueTypeChangeInType>(&baseline, current,lineNo); |
1057 AddIssue<EIssueIdentityVariable, EIssueTypeChangeInType>(&baseline, current,lineNo,issueLoc); |
1050 } |
1058 } |
1051 ++ret; |
1059 ++ret; |
1052 } |
1060 } |
1053 } |
1061 } |
1054 |
1062 |
1055 //{KXMLInitString,EOptionalSimpleAttribute} |
1063 //{KXMLInitString,EOptionalSimpleAttribute} |
1056 if ( !CompareAttributes(baseline,current,KXMLInitString,EOptionalSimpleAttribute) ) |
1064 if ( !CompareAttributes(baseline,current,KXMLInitString,EOptionalSimpleAttribute) ) |
1057 { |
1065 { |
1058 if (report) |
1066 if (report) |
1059 { |
1067 { |
1060 AddIssue<EIssueIdentityVariable, EIssueTypeChangeInInitialisation>(&baseline, current,lineNo); |
1068 AddIssue<EIssueIdentityVariable, EIssueTypeChangeInInitialisation>(&baseline, current,lineNo,issueLoc); |
1061 } |
1069 } |
1062 ++ret; |
1070 ++ret; |
1063 } |
1071 } |
1064 |
1072 |
1065 if (!CheckAccessModifier(baseline,current)) |
1073 if (!CheckAccessModifier(baseline,current)) |
1066 { |
1074 { |
1067 if (report) |
1075 if (report) |
1068 { |
1076 { |
1069 //AddIssue<iIdentity,EIssueTypeAccess>(&baseline, current); |
1077 //AddIssue<iIdentity,EIssueTypeAccess>(&baseline, current); |
1070 AddIssue<EIssueIdentityVariable,EIssueTypeAccess>(&baseline, current,lineNo); |
1078 AddIssue<EIssueIdentityVariable,EIssueTypeAccess>(&baseline, current,lineNo,issueLoc); |
1071 } |
1079 } |
1072 ret += 1; |
1080 ret += 1; |
1073 } |
1081 } |
1074 |
1082 |
1075 return ret; |
1083 return ret; |
1102 XMLSize_t enumchildcount = enumchilds->getLength(); |
1110 XMLSize_t enumchildcount = enumchilds->getLength(); |
1103 unsigned int i = 0; |
1111 unsigned int i = 0; |
1104 for (i = 0; i < enumchildcount; ++i) |
1112 for (i = 0; i < enumchildcount; ++i) |
1105 { |
1113 { |
1106 int lineNo = 0; |
1114 int lineNo = 0; |
1115 string issueLoc; |
|
1107 HANodeIterator enumchildit(baseline); |
1116 HANodeIterator enumchildit(baseline); |
1108 enumchildit.current = enumchilds->item(i); |
1117 enumchildit.current = enumchilds->item(i); |
1109 |
1118 |
1110 DOMNode* node = NodeAnalysis::findNode(enumchildit,current); |
1119 DOMNode* node = NodeAnalysis::findNode(enumchildit,current); |
1111 if ( !node ) |
1120 if ( !node ) |
1112 { |
1121 { |
1113 AddIssue<EIssueIdentityEnumerationValue,EIssueTypeRemoval>(&enumchildit, enumchildit, 0, baseline.GetAttribute(KXMLFileIdString)); |
1122 AddIssue<EIssueIdentityEnumerationValue,EIssueTypeRemoval>(&enumchildit, enumchildit, 0, "", baseline.GetAttribute(KXMLFileIdString)); |
1114 ++ret; |
1123 ++ret; |
1115 continue; |
1124 continue; |
1116 } |
1125 } |
1117 current.current = node; |
1126 current.current = node; |
1118 DOMNode* parentnode = node->getParentNode(); |
1127 DOMNode* parentnode = node->getParentNode(); |
1119 const XMLCh* lineNumber = GetAttribute(parentnode,KXMLLineString); |
1128 const XMLCh* lineNumber = GetAttribute(parentnode,KXMLLineString); |
1120 lineNo = atoi(toString(lineNumber).c_str()); |
1129 lineNo = atoi(toString(lineNumber).c_str()); |
1130 const XMLCh* fnameNode= current.GetAttribute(KXMLFileIdString); |
|
1131 if( fnameNode!= NULL) |
|
1132 { |
|
1133 HANodeIterator fileNode(current); |
|
1134 bool ret1 = fileNode.FindNodeById(fnameNode); |
|
1135 issueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
1136 } |
|
1121 |
1137 |
1122 if ( !CheckEnumValue(enumchildit,current) ) |
1138 if ( !CheckEnumValue(enumchildit,current) ) |
1123 { |
1139 { |
1124 AddIssue<EIssueIdentityEnumerationValue,EIssueTypeChangeInInitialisation>(&enumchildit, current, lineNo, baseline.GetAttribute(KXMLFileIdString)); |
1140 AddIssue<EIssueIdentityEnumerationValue,EIssueTypeChangeInInitialisation>(&enumchildit, current, lineNo, issueLoc,baseline.GetAttribute(KXMLFileIdString)); |
1125 ++ret; |
1141 ++ret; |
1126 } |
1142 } |
1127 HANodeIterator currentparent(current); |
1143 HANodeIterator currentparent(current); |
1128 if ( FindParentContext(current, currentparent)) |
1144 if ( FindParentContext(current, currentparent)) |
1129 { |
1145 { |
1130 if ( !CheckAccessModifier(baseline,currentparent) ) |
1146 if ( !CheckAccessModifier(baseline,currentparent) ) |
1131 { |
1147 { |
1132 AddIssue<EIssueIdentityEnumerationValue,EIssueTypeAccess>(&enumchildit, current, lineNo, baseline.GetAttribute(KXMLFileIdString)); |
1148 AddIssue<EIssueIdentityEnumerationValue,EIssueTypeAccess>(&enumchildit, current, lineNo, issueLoc, baseline.GetAttribute(KXMLFileIdString)); |
1133 ++ret; |
1149 ++ret; |
1134 } |
1150 } |
1135 } |
1151 } |
1136 } |
1152 } |
1137 } |
1153 } |
1139 { |
1155 { |
1140 |
1156 |
1141 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
1157 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
1142 if ( !node ) |
1158 if ( !node ) |
1143 { |
1159 { |
1144 AddIssue<EIssueIdentityEnumeration,EIssueTypeRemoval>(&baseline, baseline,0); |
1160 AddIssue<EIssueIdentityEnumeration,EIssueTypeRemoval>(&baseline, baseline,0,""); |
1145 return 1; |
1161 return 1; |
1146 } |
1162 } |
1147 current.current = node; |
1163 current.current = node; |
1148 |
1164 |
1149 ret += this->Analyse(baseline,current); |
1165 ret += this->Analyse(baseline,current); |
1176 ); |
1192 ); |
1177 |
1193 |
1178 |
1194 |
1179 int ret = 0; |
1195 int ret = 0; |
1180 int lineNo = 0; |
1196 int lineNo = 0; |
1197 string issueLoc; |
|
1181 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
1198 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
1182 lineNo = atoi(toString(lineNumber).c_str()); |
1199 lineNo = atoi(toString(lineNumber).c_str()); |
1200 const XMLCh* fnameNode = current.GetAttribute(KXMLFileIdString); |
|
1201 if( fnameNode!= NULL) |
|
1202 { |
|
1203 HANodeIterator fileNode(current); |
|
1204 bool ret1 = fileNode.FindNodeById(fnameNode); |
|
1205 issueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
1206 } |
|
1183 |
1207 |
1184 //{KXMLAlignString,ESimpleAttribute} |
1208 //{KXMLAlignString,ESimpleAttribute} |
1185 if ( !CompareAttributes(baseline,current,KXMLAlignString,ESimpleAttribute) ) |
1209 if ( !CompareAttributes(baseline,current,KXMLAlignString,ESimpleAttribute) ) |
1186 { |
1210 { |
1187 if (report) |
1211 if (report) |
1188 { |
1212 { |
1189 AddIssue<EIssueIdentityEnumeration,EIssueTypeAlign>(&baseline, current,lineNo); |
1213 AddIssue<EIssueIdentityEnumeration,EIssueTypeAlign>(&baseline, current,lineNo,issueLoc); |
1190 } |
1214 } |
1191 ++ret; |
1215 ++ret; |
1192 } |
1216 } |
1193 |
1217 |
1194 //{KXMLSizeString,ESimpleAttribute} |
1218 //{KXMLSizeString,ESimpleAttribute} |
1195 if ( !CompareAttributes(baseline,current,KXMLSizeString,ESimpleAttribute) ) |
1219 if ( !CompareAttributes(baseline,current,KXMLSizeString,ESimpleAttribute) ) |
1196 { |
1220 { |
1197 if (report) |
1221 if (report) |
1198 { |
1222 { |
1199 AddIssue<EIssueIdentityEnumeration,EIssueTypeSize>(&baseline, current,lineNo); |
1223 AddIssue<EIssueIdentityEnumeration,EIssueTypeSize>(&baseline, current,lineNo,issueLoc); |
1200 } |
1224 } |
1201 ++ret; |
1225 ++ret; |
1202 } |
1226 } |
1203 |
1227 |
1204 if (!CheckAccessModifier(baseline,current)) |
1228 if (!CheckAccessModifier(baseline,current)) |
1205 { |
1229 { |
1206 if (report) |
1230 if (report) |
1207 { |
1231 { |
1208 //AddIssue<iIdentity,EIssueTypeAccess>(&baseline, current); |
1232 //AddIssue<iIdentity,EIssueTypeAccess>(&baseline, current); |
1209 AddIssue<EIssueIdentityEnumeration, EIssueTypeAccess>(&baseline, current,lineNo); |
1233 AddIssue<EIssueIdentityEnumeration, EIssueTypeAccess>(&baseline, current,lineNo,issueLoc); |
1210 } |
1234 } |
1211 ++ret; |
1235 ++ret; |
1212 } |
1236 } |
1213 |
1237 |
1214 //Check the enum values |
1238 //Check the enum values |
1233 { |
1257 { |
1234 if ( !CompareAttributes(baselineit,currentit,KXMLInitString,ESimpleAttribute) ) |
1258 if ( !CompareAttributes(baselineit,currentit,KXMLInitString,ESimpleAttribute) ) |
1235 { |
1259 { |
1236 if (report) |
1260 if (report) |
1237 { |
1261 { |
1238 AddIssue<EIssueIdentityEnumeration,EIssueTypeChange>(&baseline, current,lineNo); |
1262 AddIssue<EIssueIdentityEnumeration,EIssueTypeChange>(&baseline, current,lineNo,issueLoc); |
1239 } |
1263 } |
1240 ++ret; |
1264 ++ret; |
1241 return ret; |
1265 return ret; |
1242 } |
1266 } |
1243 break; |
1267 break; |
1248 if ( currentchildcount == ii ) |
1272 if ( currentchildcount == ii ) |
1249 { |
1273 { |
1250 |
1274 |
1251 if (report) |
1275 if (report) |
1252 { |
1276 { |
1253 AddIssue<EIssueIdentityEnumerationValue,EIssueTypeRemoval>(&baseline, current,lineNo); |
1277 AddIssue<EIssueIdentityEnumerationValue,EIssueTypeRemoval>(&baseline, current,lineNo,issueLoc); |
1254 } |
1278 } |
1255 ++ret; |
1279 ++ret; |
1256 return ret; |
1280 return ret; |
1257 } |
1281 } |
1258 } |
1282 } |
1303 { |
1327 { |
1304 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
1328 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
1305 if ( !node ) |
1329 if ( !node ) |
1306 { |
1330 { |
1307 //AddIssue<iFuncType,EIssueTypeRemoval>(&baseline, baseline); |
1331 //AddIssue<iFuncType,EIssueTypeRemoval>(&baseline, baseline); |
1308 AddIssueFunction<EIssueTypeRemoval>(&baseline,iFuncType,baseline,0); |
1332 AddIssueFunction<EIssueTypeRemoval>(&baseline,iFuncType,baseline,0,""); |
1309 return 1; |
1333 return 1; |
1310 } |
1334 } |
1311 current.current = node; |
1335 current.current = node; |
1312 |
1336 |
1313 return this->Analyse(baseline,current); |
1337 return this->Analyse(baseline,current); |
1332 //<!ATTLIST FunctionType attributes CDATA #IMPLIED> |
1356 //<!ATTLIST FunctionType attributes CDATA #IMPLIED> |
1333 //<!ATTLIST FunctionType id ID #REQUIRED> |
1357 //<!ATTLIST FunctionType id ID #REQUIRED> |
1334 //<!ATTLIST FunctionType returns IDREF #REQUIRED> |
1358 //<!ATTLIST FunctionType returns IDREF #REQUIRED> |
1335 |
1359 |
1336 int lineNo = 0; |
1360 int lineNo = 0; |
1361 string issueLoc; |
|
1337 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
1362 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
1338 lineNo = atoi(toString(lineNumber).c_str()); |
1363 lineNo = atoi(toString(lineNumber).c_str()); |
1364 const XMLCh* fnameNode = current.GetAttribute(KXMLFileIdString); |
|
1365 if( fnameNode!= NULL) |
|
1366 { |
|
1367 HANodeIterator fileNode(current); |
|
1368 bool ret1 = fileNode.FindNodeById(fnameNode); |
|
1369 issueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
1370 } |
|
1339 |
1371 |
1340 const XMLCh* attributeValue = current.GetAttribute(KXMLAttributeString); |
1372 const XMLCh* attributeValue = current.GetAttribute(KXMLAttributeString); |
1341 if ( |
1373 if ( |
1342 ( |
1374 ( |
1343 (iFuncType == EIssueIdentityInlineFunction) && !current.CheckForBooleanAttribute(KXMLInlineString) |
1375 (iFuncType == EIssueIdentityInlineFunction) && !current.CheckForBooleanAttribute(KXMLInlineString) |
1349 ) |
1381 ) |
1350 ) |
1382 ) |
1351 { |
1383 { |
1352 if (report) |
1384 if (report) |
1353 { |
1385 { |
1354 AddIssueFunction<EIssueTypeRemoval>(&baseline,iFuncType,baseline,0); |
1386 AddIssueFunction<EIssueTypeRemoval>(&baseline,iFuncType,baseline,0,""); |
1355 |
1387 |
1356 } |
1388 } |
1357 ++ret; |
1389 ++ret; |
1358 return ret; |
1390 return ret; |
1359 } |
1391 } |
1364 if ( basefuncsig != currentfuncsig ) |
1396 if ( basefuncsig != currentfuncsig ) |
1365 { |
1397 { |
1366 ++ret; |
1398 ++ret; |
1367 if (report) |
1399 if (report) |
1368 { |
1400 { |
1369 AddIssueFunction<EIssueTypeParam>(&baseline,iFuncType,current,lineNo); |
1401 AddIssueFunction<EIssueTypeParam>(&baseline,iFuncType,current,lineNo,issueLoc); |
1370 } |
1402 } |
1371 } |
1403 } |
1372 else |
1404 else |
1373 { |
1405 { |
1374 //Check also the default parameter values |
1406 //Check also the default parameter values |
1407 if ( !currentsize ) |
1439 if ( !currentsize ) |
1408 { |
1440 { |
1409 currentsize = currentalign; |
1441 currentsize = currentalign; |
1410 } |
1442 } |
1411 |
1443 |
1412 if ( !Equals(baselinesize,currentsize) || !Equals(baselinealign, currentalign) || |
1444 if ( !Equals(baselinesize,currentsize) || !Equals(baselinealign, currentalign) ) |
1413 !CompareAttributes(baselinechildit,currentchildit,KXMLDefaultString,EOptionalSimpleAttribute)) |
|
1414 { |
1445 { |
1415 ++ret; |
1446 ++ret; |
1416 if (report) |
1447 if (report) |
1417 { |
1448 { |
1418 //AddIssue<iFuncType,EIssueTypeParam>(&baseline, current); |
1449 //AddIssue<iFuncType,EIssueTypeParam>(&baseline, current); |
1419 AddIssueFunction<EIssueTypeParam>(&baseline,iFuncType,current,lineNo); |
1450 AddIssueFunction<EIssueTypeParam>(&baseline,iFuncType,current,lineNo,issueLoc); |
1420 } |
1451 } |
1421 break; |
1452 break; |
1453 } |
|
1454 // if default value is changed then it should be reported as informative |
|
1455 if(!CompareAttributes(baselinechildit,currentchildit,KXMLDefaultString,EOptionalSimpleAttribute)) |
|
1456 { |
|
1457 ++ret; |
|
1458 if (report) |
|
1459 { |
|
1460 AddIssueFunction<EIssueTypeDefaultParam>(&baseline,iFuncType,current,lineNo,issueLoc); |
|
1461 } |
|
1462 break; |
|
1422 } |
1463 } |
1423 } |
1464 } |
1424 |
1465 |
1425 } |
1466 } |
1426 |
1467 |
1429 if ( !CompareAttributes(baseline,current,KXMLReturnsString,EOptionalTypeAttribute) ) |
1470 if ( !CompareAttributes(baseline,current,KXMLReturnsString,EOptionalTypeAttribute) ) |
1430 { |
1471 { |
1431 ++ret; |
1472 ++ret; |
1432 if (report) |
1473 if (report) |
1433 { |
1474 { |
1434 AddIssueFunction<EIssueTypeReturn>(&baseline,iFuncType,current,lineNo); |
1475 AddIssueFunction<EIssueTypeReturn>(&baseline,iFuncType,current,lineNo,issueLoc); |
1435 } |
1476 } |
1436 } |
1477 } |
1437 |
1478 |
1438 return ret; |
1479 return ret; |
1439 } |
1480 } |
1459 int TypedefNodeAnalysis::FindNodeAndAnalyse(HANodeIterator baseline,HANodeIterator current) |
1500 int TypedefNodeAnalysis::FindNodeAndAnalyse(HANodeIterator baseline,HANodeIterator current) |
1460 { |
1501 { |
1461 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
1502 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
1462 if ( !node ) |
1503 if ( !node ) |
1463 { |
1504 { |
1464 AddIssue<EIssueIdentityTypedef,EIssueTypeRemoval>(&baseline, baseline,0); |
1505 AddIssue<EIssueIdentityTypedef,EIssueTypeRemoval>(&baseline, baseline,0,""); |
1465 return 1; |
1506 return 1; |
1466 } |
1507 } |
1467 current.current = node; |
1508 current.current = node; |
1468 |
1509 |
1469 return this->Analyse(baseline,current); |
1510 return this->Analyse(baseline,current); |
1481 ); |
1522 ); |
1482 |
1523 |
1483 //<Typedef id="_9" name="TOmaInt" type="_8" context="_1" location="f0:108" file="f0" line="108"/> |
1524 //<Typedef id="_9" name="TOmaInt" type="_8" context="_1" location="f0:108" file="f0" line="108"/> |
1484 |
1525 |
1485 int lineNo = 0; |
1526 int lineNo = 0; |
1527 string issueLoc; |
|
1486 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
1528 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
1487 lineNo = atoi(toString(lineNumber).c_str()); |
1529 lineNo = atoi(toString(lineNumber).c_str()); |
1530 const XMLCh* fnameNode = current.GetAttribute(KXMLFileIdString); |
|
1531 if( fnameNode != NULL) |
|
1532 { |
|
1533 HANodeIterator fileNode(current); |
|
1534 bool retval= fileNode.FindNodeById(fnameNode); |
|
1535 issueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
1536 } |
|
1488 |
1537 |
1489 int ret = 0; |
1538 int ret = 0; |
1490 |
1539 |
1491 if ( !CompareAttributes(baseline,current,KXMLNameString,ESimpleAttribute) ) |
1540 if ( !CompareAttributes(baseline,current,KXMLNameString,ESimpleAttribute) ) |
1492 { |
1541 { |
1493 if (report) |
1542 if (report) |
1494 { |
1543 { |
1495 AddIssue<EIssueIdentityTypedef,EIssueTypeChange>(&baseline, current,lineNo); |
1544 AddIssue<EIssueIdentityTypedef,EIssueTypeChange>(&baseline, current,lineNo,issueLoc); |
1496 } |
1545 } |
1497 ++ret; |
1546 ++ret; |
1498 } |
1547 } |
1499 |
1548 |
1500 if ( !CompareAttributes(baseline,current,KXMLTypeString,ETypeAttribute) ) |
1549 if ( !CompareAttributes(baseline,current,KXMLTypeString,ETypeAttribute) ) |
1501 { |
1550 { |
1502 if (report) |
1551 if (report) |
1503 { |
1552 { |
1504 AddIssue<EIssueIdentityTypedef,EIssueTypeChange>(&baseline, current,lineNo); |
1553 AddIssue<EIssueIdentityTypedef,EIssueTypeChange>(&baseline, current,lineNo,issueLoc); |
1505 } |
1554 } |
1506 ++ret; |
1555 ++ret; |
1507 } |
1556 } |
1508 |
1557 |
1509 HANodeIterator baselinetypeit(baseline); |
1558 HANodeIterator baselinetypeit(baseline); |
1523 { |
1572 { |
1524 if ( !CompareAttributes(baselinetypeit,currenttypeit,KXMLReturnsString,EOptionalTypeAttribute) ) |
1573 if ( !CompareAttributes(baselinetypeit,currenttypeit,KXMLReturnsString,EOptionalTypeAttribute) ) |
1525 { |
1574 { |
1526 if (report) |
1575 if (report) |
1527 { |
1576 { |
1528 AddIssue<EIssueIdentityTypedef,EIssueTypeChange>(&baseline, current,lineNo); |
1577 AddIssue<EIssueIdentityTypedef,EIssueTypeChange>(&baseline, current,lineNo,issueLoc); |
1529 } |
1578 } |
1530 ++ret; |
1579 ++ret; |
1531 } |
1580 } |
1532 } |
1581 } |
1533 |
1582 |
1534 if (!CheckAccessModifier(baseline,current)) |
1583 if (!CheckAccessModifier(baseline,current)) |
1535 { |
1584 { |
1536 if (report) |
1585 if (report) |
1537 { |
1586 { |
1538 //AddIssue<iIdentity,EIssueTypeAccess>(&baseline, current); |
1587 //AddIssue<iIdentity,EIssueTypeAccess>(&baseline, current); |
1539 AddIssue<EIssueIdentityTypedef,EIssueTypeAccess>(&baseline, current,lineNo); |
1588 AddIssue<EIssueIdentityTypedef,EIssueTypeAccess>(&baseline, current,lineNo,issueLoc); |
1540 } |
1589 } |
1541 ret += 1; |
1590 ret += 1; |
1542 } |
1591 } |
1543 |
1592 |
1544 return ret; |
1593 return ret; |
1610 |
1659 |
1611 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
1660 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
1612 |
1661 |
1613 if ( !node ) |
1662 if ( !node ) |
1614 { |
1663 { |
1615 AddIssue<EIssueIdentityUnion,EIssueTypeRemoval>(&baseline, baseline,0); |
1664 AddIssue<EIssueIdentityUnion,EIssueTypeRemoval>(&baseline, baseline,0,""); |
1616 return 1; |
1665 return 1; |
1617 } |
1666 } |
1618 current.current = node; |
1667 current.current = node; |
1619 |
1668 |
1620 return this->Analyse(baseline,current); |
1669 return this->Analyse(baseline,current); |
1751 int currentoffset = currentmember.iOffset; |
1800 int currentoffset = currentmember.iOffset; |
1752 |
1801 |
1753 TIssueIdentity identity = EIssueIdentityField; |
1802 TIssueIdentity identity = EIssueIdentityField; |
1754 bool accessthroughinline = false; |
1803 bool accessthroughinline = false; |
1755 |
1804 |
1805 string issueLoc; |
|
1806 const XMLCh* fnameNode = current.GetAttribute(KXMLFileIdString); |
|
1807 if( fnameNode!= NULL) |
|
1808 { |
|
1809 HANodeIterator fileNode(current); |
|
1810 bool ret1 = fileNode.FindNodeById(fnameNode); |
|
1811 issueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
1812 } |
|
1813 |
|
1756 if ( !CheckAccessibility(baseline,accessthroughinline,basemember.iAccess) ) |
1814 if ( !CheckAccessibility(baseline,accessthroughinline,basemember.iAccess) ) |
1757 { |
1815 { |
1758 identity = EIssueIdentityFieldInaccessible; |
1816 identity = EIssueIdentityFieldInaccessible; |
1759 } else |
1817 } else |
1760 { |
1818 { |
1762 if ( baseoffset != currentoffset ) |
1820 if ( baseoffset != currentoffset ) |
1763 { |
1821 { |
1764 ret++; |
1822 ret++; |
1765 if ( report ) |
1823 if ( report ) |
1766 { |
1824 { |
1767 AddIssueField<EIssueTypeOffset>(&baseline,identity, currentfield,currentmember.iLineNo,NULL,basemember); |
1825 AddIssueField<EIssueTypeOffset>(&baseline,identity, currentfield,currentmember.iLineNo, |
1826 issueLoc,NULL,basemember); |
|
1768 } |
1827 } |
1769 else |
1828 else |
1770 { |
1829 { |
1771 return ret; |
1830 return ret; |
1772 } |
1831 } |
1800 |
1859 |
1801 if ( !ret2 || !baselinetypeanonit.IsSameNodeType(currenttypeanonit) ) |
1860 if ( !ret2 || !baselinetypeanonit.IsSameNodeType(currenttypeanonit) ) |
1802 { |
1861 { |
1803 if (report) |
1862 if (report) |
1804 { |
1863 { |
1805 AddIssueField<EIssueTypeChangeInType>(&baseline,identity, currentfield,currentmember.iLineNo,NULL,basemember); |
1864 AddIssueField<EIssueTypeChangeInType>(&baseline,identity, currentfield,currentmember.iLineNo, |
1865 issueLoc, NULL,basemember); |
|
1806 } |
1866 } |
1807 ret++; |
1867 ret++; |
1808 } |
1868 } |
1809 else |
1869 else |
1810 { |
1870 { |
1820 int retval2 = analyser->Analyse(baselinetypeanonit,currenttypeanonit,report2); |
1880 int retval2 = analyser->Analyse(baselinetypeanonit,currenttypeanonit,report2); |
1821 if ( retval2 > 0 && !report2) |
1881 if ( retval2 > 0 && !report2) |
1822 { |
1882 { |
1823 if (report) |
1883 if (report) |
1824 { |
1884 { |
1825 AddIssueField<EIssueTypeChangeInType>(&baseline,identity, currentfield,currentmember.iLineNo,NULL,basemember); |
1885 AddIssueField<EIssueTypeChangeInType>(&baseline,identity, currentfield,currentmember.iLineNo, |
1886 issueLoc,NULL,basemember); |
|
1826 } |
1887 } |
1827 ++ret; |
1888 ++ret; |
1828 } |
1889 } |
1829 delete analyser; |
1890 delete analyser; |
1830 } |
1891 } |
1835 if ( !CompareAttributes(basefield,currentfield,KXMLTypeString,ETypeAttribute) ) |
1896 if ( !CompareAttributes(basefield,currentfield,KXMLTypeString,ETypeAttribute) ) |
1836 { |
1897 { |
1837 ret++; |
1898 ret++; |
1838 if ( report ) |
1899 if ( report ) |
1839 { |
1900 { |
1840 AddIssueField<EIssueTypeChangeInType>(&baseline,identity, currentfield,currentmember.iLineNo,NULL,basemember); |
1901 AddIssueField<EIssueTypeChangeInType>(&baseline,identity, currentfield,currentmember.iLineNo, |
1902 issueLoc,NULL,basemember); |
|
1841 } |
1903 } |
1842 else |
1904 else |
1843 { |
1905 { |
1844 return ret; |
1906 return ret; |
1845 } |
1907 } |
1851 if ( !Equals(basefieldsize,currentfieldsize) ) |
1913 if ( !Equals(basefieldsize,currentfieldsize) ) |
1852 { |
1914 { |
1853 ret++; |
1915 ret++; |
1854 if ( report ) |
1916 if ( report ) |
1855 { |
1917 { |
1856 AddIssueField<EIssueTypeSize>(&baseline,identity, currentfield,currentmember.iLineNo,NULL,basemember); |
1918 AddIssueField<EIssueTypeSize>(&baseline,identity, currentfield,currentmember.iLineNo, |
1919 issueLoc,NULL,basemember); |
|
1857 } |
1920 } |
1858 else |
1921 else |
1859 { |
1922 { |
1860 return ret; |
1923 return ret; |
1861 } |
1924 } |
1912 // Get default comparator: |
1975 // Get default comparator: |
1913 const ComparatorVector& cmps = ComparatorFactory::Instance().GetComparators(); |
1976 const ComparatorVector& cmps = ComparatorFactory::Instance().GetComparators(); |
1914 ComparatorVector::const_iterator comparator = cmps.begin(); |
1977 ComparatorVector::const_iterator comparator = cmps.begin(); |
1915 const XMLCh* parenLinenumber = current.GetAttribute( KXMLLineString); |
1978 const XMLCh* parenLinenumber = current.GetAttribute( KXMLLineString); |
1916 parentLineNo = atoi(toString(parenLinenumber).c_str()); |
1979 parentLineNo = atoi(toString(parenLinenumber).c_str()); |
1980 |
|
1981 string parentIssueLoc; |
|
1982 const XMLCh* fnameNode = current.GetAttribute(KXMLFileIdString); |
|
1983 if(fnameNode != NULL) |
|
1984 { |
|
1985 HANodeIterator fileNode(current); |
|
1986 bool ret1 = fileNode.FindNodeById(fnameNode); |
|
1987 parentIssueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
1988 } |
|
1917 |
1989 |
1918 // Build method maps for baseline and current platform's classes: |
1990 // Build method maps for baseline and current platform's classes: |
1919 MethodMatchMap baseMap; |
1991 MethodMatchMap baseMap; |
1920 vector<DOMNode*>::const_iterator i = bexportedMethods.begin(); |
1992 vector<DOMNode*>::const_iterator i = bexportedMethods.begin(); |
1921 for( ; i != bexportedMethods.end(); ++i ) |
1993 for( ; i != bexportedMethods.end(); ++i ) |
1959 if( baseFunc->second.signatureMatch == false ) |
2031 if( baseFunc->second.signatureMatch == false ) |
1960 { |
2032 { |
1961 // Function signatures do not match |
2033 // Function signatures do not match |
1962 HANodeIterator removedMethod(baseline); |
2034 HANodeIterator removedMethod(baseline); |
1963 removedMethod.current = baseFunc->first; |
2035 removedMethod.current = baseFunc->first; |
1964 AddIssueFunction<EIssueTypeRemoval>(&removedMethod, identity, removedMethod,parentLineNo); |
2036 AddIssueFunction<EIssueTypeRemoval>(&removedMethod, identity, removedMethod,parentLineNo,parentIssueLoc); |
1965 ++ret; |
2037 ++ret; |
1966 } |
2038 } |
1967 else if( baseFunc->second.returnValueMatch == false ) |
2039 else if( baseFunc->second.returnValueMatch == false ) |
1968 { |
2040 { |
1969 // Function return values do not match |
2041 // Function return values do not match |
1970 HANodeIterator removedMethod(baseline); |
2042 HANodeIterator removedMethod(baseline); |
1971 removedMethod.current = baseFunc->first; |
2043 removedMethod.current = baseFunc->first; |
1972 AddIssueFunction<EIssueTypeReturn>(&removedMethod,identity, removedMethod,lineNo); |
2044 AddIssueFunction<EIssueTypeReturn>(&removedMethod,identity, removedMethod,lineNo,parentIssueLoc); |
1973 ++ret; |
2045 ++ret; |
1974 } |
2046 } |
1975 } |
2047 } |
1976 } |
2048 } |
1977 return ret; |
2049 return ret; |
2000 |
2072 |
2001 //Exported methods |
2073 //Exported methods |
2002 vector<DOMNode*>::const_iterator bIter = bexportedMethods.begin(); |
2074 vector<DOMNode*>::const_iterator bIter = bexportedMethods.begin(); |
2003 for( ; bIter != bexportedMethods.end(); ++bIter ) |
2075 for( ; bIter != bexportedMethods.end(); ++bIter ) |
2004 { |
2076 { |
2077 int baseCount = 0; |
|
2078 int currCount = 0; |
|
2005 MethodMatchMap::iterator baseMapIter = baseMap.find(*bIter); |
2079 MethodMatchMap::iterator baseMapIter = baseMap.find(*bIter); |
2006 assert(baseMapIter != baseMap.end()); |
2080 assert(baseMapIter != baseMap.end()); |
2007 if( baseMapIter->second.signatureMatch ) |
2081 if( baseMapIter->second.signatureMatch ) |
2008 { |
2082 { |
2009 continue; // This method has already been found and analyzed. |
2083 continue; // This method has already been found and analyzed. |
2010 } |
2084 } |
2011 HANodeIterator basemethod(baseline); |
2085 HANodeIterator basemethod(baseline); |
2012 basemethod.current = *bIter; |
2086 basemethod.current = *bIter; |
2013 |
2087 |
2014 //Check the accessibility |
2088 vector<DOMNode*>::const_iterator cIter = cexportedMethods.begin(); |
2015 if ( CheckAccessibility(basemethod) ) |
2089 const XMLCh* baseMathodID = basemethod->getNodeName(); |
2016 { |
2090 const XMLCh* basenameatt; |
2017 vector<DOMNode*>::const_iterator cIter = cexportedMethods.begin(); |
2091 const XMLCh* basereturnatt; |
2018 |
2092 const XMLCh* basemangledatt; |
2093 if(Equals(baseMathodID,KXMLMethodString)) |
|
2094 { |
|
2095 basenameatt = basemethod.GetAttribute(KXMLNameString); |
|
2096 HANodeIterator baseReturMathod(basemethod); |
|
2097 bool ret = baseReturMathod.FindNodeById(basemethod.GetAttribute(KXMLReturnsString)); |
|
2098 basereturnatt = baseReturMathod.GetAttribute(KXMLNameString); |
|
2099 basemangledatt = basemethod.GetAttribute(KXMLMangledString); |
|
2100 } |
|
2101 for( ; cIter != cexportedMethods.end(); ++cIter) |
|
2102 { |
|
2103 HANodeIterator currentmethod(current); |
|
2104 currentmethod.current = *cIter; |
|
2105 const XMLCh* lineNumber1 = GetAttribute(currentmethod.current,KXMLLineString); |
|
2106 lineNo1 = atoi(toString(lineNumber1).c_str()); |
|
2107 |
|
2108 string issueLoc; |
|
2109 const XMLCh* fnameNode = currentmethod.GetAttribute(KXMLFileIdString); |
|
2110 if( fnameNode!= NULL) |
|
2111 { |
|
2112 HANodeIterator fileNode(currentmethod); |
|
2113 bool retval = fileNode.FindNodeById(fnameNode); |
|
2114 issueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
2115 } |
|
2116 |
|
2117 MethodMatchMap::iterator currMapIter = currMap.find(*cIter); |
|
2118 |
|
2119 const XMLCh* curMathodID = currentmethod->getNodeName(); |
|
2120 if(Equals(curMathodID,KXMLMethodString)) |
|
2121 { |
|
2122 HANodeIterator curReturMathod(currentmethod); |
|
2123 bool ret1 = curReturMathod.FindNodeById(currentmethod.GetAttribute(KXMLReturnsString)); |
|
2124 const XMLCh* curReturnatt = curReturMathod.GetAttribute(KXMLNameString); |
|
2125 |
|
2126 // check for overloaded function, first time matching the name, return type and signature |
|
2127 if( Equals(baseMathodID,KXMLMethodString)&& |
|
2128 Equals(basenameatt, currentmethod.GetAttribute(KXMLNameString)) && |
|
2129 Equals(basereturnatt, curReturnatt) && |
|
2130 Equals(basemangledatt, currentmethod.GetAttribute(KXMLMangledString)) ) |
|
2131 { |
|
2132 baseCount++;// match found |
|
2133 } |
|
2134 |
|
2135 |
|
2136 } |
|
2137 |
|
2138 if( currMapIter != currMap.end() && |
|
2139 currMapIter->second.signatureMatch == false && |
|
2140 compareMethodsSignature(basemethod, currentmethod, **comparator) ) |
|
2141 { |
|
2142 if( comparatorRound==CONSTFILTER_COMPARATOR ) |
|
2143 { |
|
2144 // if one of the parameter has changed from non-const to const |
|
2145 ret++; |
|
2146 if(report) |
|
2147 { |
|
2148 //add the issue as it is a source compatibility break |
|
2149 AddIssueFunction<EIssueTypeParamConst>(&basemethod,identity,currentmethod,lineNo1,issueLoc); |
|
2150 } |
|
2151 |
|
2152 //make signature and return value true so that the issue is not reported again |
|
2153 if( baseMapIter != baseMap.end() ) |
|
2154 baseMapIter->second.signatureMatch = true; |
|
2155 currMapIter->second.signatureMatch = true; |
|
2156 |
|
2157 baseMapIter->second.returnValueMatch = true; |
|
2158 currMapIter->second.returnValueMatch = true; |
|
2159 break; |
|
2160 } |
|
2161 |
|
2162 else if( comparatorRound==CONSTFILTER2_COMPARATOR ) |
|
2163 { |
|
2164 // if one of the parameter has changed from const to non-const |
|
2165 ret++; |
|
2166 if(report) |
|
2167 { |
|
2168 //add the issue as it is a source compatibility break |
|
2169 AddIssueFunction<EIssueTypeParamConst2>(&basemethod,identity,currentmethod,lineNo1,issueLoc); |
|
2170 } |
|
2171 |
|
2172 //make signature and return value true so that the issue is not reported again |
|
2173 if( baseMapIter != baseMap.end() ) |
|
2174 baseMapIter->second.signatureMatch = true; |
|
2175 currMapIter->second.signatureMatch = true; |
|
2176 |
|
2177 baseMapIter->second.returnValueMatch = true; |
|
2178 currMapIter->second.returnValueMatch = true; |
|
2179 break; |
|
2180 } |
|
2181 |
|
2182 if( baseMapIter != baseMap.end() ) |
|
2183 baseMapIter->second.signatureMatch = true; |
|
2184 currMapIter->second.signatureMatch = true; |
|
2185 //Check also the default parameter values |
|
2186 DOMElement * baselineelement = static_cast<DOMElement*>(basemethod.current); |
|
2187 DOMNodeList* baselinechilds = baselineelement->getChildNodes(); |
|
2188 DOMElement * currentelement = static_cast<DOMElement*>(currentmethod.current); |
|
2189 DOMNodeList* currentchilds = currentelement->getChildNodes(); |
|
2190 |
|
2191 XMLSize_t childcount = baselinechilds->getLength(); |
|
2192 |
|
2193 unsigned int i = 0; |
|
2194 for (i = 0; i < childcount; ++i) |
|
2195 { |
|
2196 DOMNode* baselinechild = baselinechilds->item(i); |
|
2197 HANodeIterator baselinechildit(baseline); |
|
2198 baselinechildit.current = baselinechild; |
|
2199 |
|
2200 DOMNode* currentchild = currentchilds->item(i); |
|
2201 HANodeIterator currentchildit(current); |
|
2202 currentchildit.current = currentchild; |
|
2203 |
|
2204 short nodetype = baselinechildit->getNodeType(); |
|
2205 if (nodetype == DOMNode::ELEMENT_NODE) |
|
2206 { |
|
2207 const XMLCh * baselinesize = FindAttributeValueForType(baselinechildit,KXMLSizeString); |
|
2208 const XMLCh * currentsize = FindAttributeValueForType(currentchildit,KXMLSizeString); |
|
2209 |
|
2210 const XMLCh * baselinealign = FindAttributeValueForType(baselinechildit,KXMLAlignString); |
|
2211 const XMLCh * currentalign = FindAttributeValueForType(currentchildit,KXMLAlignString); |
|
2212 |
|
2213 if ( !baselinesize ) |
|
2214 { |
|
2215 baselinesize = baselinealign; |
|
2216 } |
|
2217 |
|
2218 if ( !currentsize ) |
|
2219 { |
|
2220 currentsize = currentalign; |
|
2221 } |
|
2222 |
|
2223 if ( !Equals(baselinesize,currentsize) || !Equals(baselinealign, currentalign) ) |
|
2224 { |
|
2225 ++ret; |
|
2226 if (report) |
|
2227 { |
|
2228 AddIssueFunction<EIssueTypeParam>(&basemethod,identity,currentmethod,lineNo1,issueLoc); |
|
2229 } |
|
2230 break; |
|
2231 } |
|
2232 // if default value is changed then it should be reported as informative |
|
2233 if(!CompareAttributes(baselinechildit,currentchildit,KXMLDefaultString,EOptionalSimpleAttribute)) |
|
2234 { |
|
2235 ++ret; |
|
2236 if (report) |
|
2237 { |
|
2238 AddIssueFunction<EIssueTypeDefaultParam>(&basemethod,identity,currentmethod,lineNo1,issueLoc); |
|
2239 } |
|
2240 break; |
|
2241 } |
|
2242 } |
|
2243 } |
|
2244 |
|
2245 // Check function return values |
|
2246 const ComparatorVector& cmps = ComparatorFactory::Instance().GetComparators(); |
|
2247 ComparatorVector::const_iterator retComparator = cmps.begin(); |
|
2248 int retComparatorRound = 1; |
|
2249 for ( ; retComparator != cmps.end(); retComparator++ ) |
|
2250 { |
|
2251 if ( compareMethodsReturn(basemethod,currentmethod, **retComparator) ) |
|
2252 { |
|
2253 if( retComparatorRound==CONSTFILTER_COMPARATOR ) |
|
2254 { |
|
2255 // if the return value has changed from const to non-const |
|
2256 ret++; |
|
2257 if(report) |
|
2258 { |
|
2259 //add the issue as it is a source compatibility break |
|
2260 AddIssueFunction<EIssueTypeReturnConst>(&basemethod,identity,currentmethod,lineNo1,issueLoc); |
|
2261 } |
|
2262 } |
|
2263 else if( retComparatorRound==CONSTFILTER2_COMPARATOR ) |
|
2264 { |
|
2265 // if the return calue has changed from non-const to const |
|
2266 ret++; |
|
2267 if(report) |
|
2268 { |
|
2269 //add the issue as it is a source compatibility break |
|
2270 AddIssueFunction<EIssueTypeReturnConst2>(&basemethod,identity,currentmethod,lineNo1,issueLoc); |
|
2271 } |
|
2272 } |
|
2273 |
|
2274 baseMapIter->second.returnValueMatch = true; |
|
2275 currMapIter->second.returnValueMatch = true; |
|
2276 break; |
|
2277 } |
|
2278 retComparatorRound++; |
|
2279 } |
|
2280 |
|
2281 |
|
2282 if ( !CheckAccessModifier(basemethod,currentmethod) ) |
|
2283 { |
|
2284 if (report) |
|
2285 { |
|
2286 AddIssueFunction<EIssueTypeAccess>(&basemethod,identity, currentmethod,lineNo1,issueLoc); |
|
2287 } |
|
2288 ++ret; |
|
2289 } |
|
2290 break; |
|
2291 } |
|
2292 } // end of cuurent mathod loop |
|
2293 // check for overloaded function in current having same name and return type with diff signature |
|
2294 if (baseCount) |
|
2295 { |
|
2296 currCount++; |
|
2297 cIter = cexportedMethods.begin(); |
|
2298 int lineNo; |
|
2299 string fileName; |
|
2019 for( ; cIter != cexportedMethods.end(); ++cIter) |
2300 for( ; cIter != cexportedMethods.end(); ++cIter) |
2020 { |
2301 { |
2021 HANodeIterator currentmethod(current); |
2302 HANodeIterator currentmethod(current); |
2022 currentmethod.current = *cIter; |
2303 currentmethod.current = *cIter; |
2023 const XMLCh* lineNumber1 = GetAttribute(currentmethod.current,KXMLLineString); |
2304 |
2024 lineNo1 = atoi(toString(lineNumber1).c_str()); |
2305 const XMLCh* curMathodID = currentmethod->getNodeName(); |
2025 |
2306 if(Equals(curMathodID,KXMLMethodString)) |
2026 MethodMatchMap::iterator currMapIter = currMap.find(*cIter); |
2307 { |
2027 |
2308 HANodeIterator curReturMathod(currentmethod); |
2028 if( currMapIter != currMap.end() && |
2309 bool ret1 = curReturMathod.FindNodeById(currentmethod.GetAttribute(KXMLReturnsString)); |
2029 currMapIter->second.signatureMatch == false && |
2310 const XMLCh* curReturnatt = curReturMathod.GetAttribute(KXMLNameString); |
2030 compareMethodsSignature(basemethod, currentmethod, **comparator) ) |
2311 |
2031 { |
2312 const XMLCh* lineNumber1 = GetAttribute(currentmethod.current,KXMLLineString); |
2032 if( comparatorRound==CONSTFILTER_COMPARATOR ) |
2313 lineNo = atoi(toString(lineNumber1).c_str()); |
2033 { |
2314 const XMLCh* fnameNode = currentmethod.GetAttribute(KXMLFileIdString); |
2034 // if one of the parameter has changed from non-const to const |
2315 if(fnameNode != NULL) |
2035 ret++; |
2316 { |
2036 if(report) |
2317 HANodeIterator filenode1(currentmethod); |
2037 { |
2318 ret1 = filenode1.FindNodeById(fnameNode); |
2038 //add the issue as it is a source compatibility break |
2319 fileName = toString(filenode1.GetAttribute(KXMLNameString)); |
2039 AddIssueFunction<EIssueTypeParamConst>(&basemethod,identity,currentmethod,lineNo1); |
2320 } |
2040 } |
2321 |
2041 |
2322 if(Equals(basenameatt, currentmethod.GetAttribute(KXMLNameString)) && |
2042 //make signature and return value true so that the issue is not reported again |
2323 Equals(basereturnatt, curReturnatt ) && |
2043 if( baseMapIter != baseMap.end() ) |
2324 !Equals(basemangledatt, currentmethod.GetAttribute(KXMLMangledString)) ) |
2044 baseMapIter->second.signatureMatch = true; |
2325 { |
2045 currMapIter->second.signatureMatch = true; |
2326 currCount++;// overloaded function found in current |
2046 |
2327 break; |
2047 baseMapIter->second.returnValueMatch = true; |
2328 } |
2048 currMapIter->second.returnValueMatch = true; |
2329 } |
2049 break; |
2330 } |
2050 } |
2331 |
2051 |
2332 //Now check if the function is overloaded in base also or not . |
2052 else if( comparatorRound==CONSTFILTER2_COMPARATOR ) |
2333 if(currCount > 1) |
2053 { |
2334 { |
2054 // if one of the parameter has changed from const to non-const |
2335 vector<DOMNode*>::const_iterator baseInnerIter = bexportedMethods.begin(); |
2055 ret++; |
2336 for( ; baseInnerIter != bexportedMethods.end(); ++baseInnerIter ) |
2056 if(report) |
2337 { |
2057 { |
2338 HANodeIterator bmethod(baseline); |
2058 //add the issue as it is a source compatibility break |
2339 bmethod.current = *baseInnerIter; |
2059 AddIssueFunction<EIssueTypeParamConst2>(&basemethod,identity,currentmethod,lineNo1); |
2340 |
2060 } |
2341 const XMLCh* bMathodID = bmethod->getNodeName(); |
2061 |
2342 if(Equals(bMathodID,KXMLMethodString)) |
2062 //make signature and return value true so that the issue is not reported again |
2343 { |
2063 if( baseMapIter != baseMap.end() ) |
2344 HANodeIterator returMathod(bmethod); |
2064 baseMapIter->second.signatureMatch = true; |
2345 bool ret1 = returMathod.FindNodeById(bmethod.GetAttribute(KXMLReturnsString)); |
2065 currMapIter->second.signatureMatch = true; |
2346 const XMLCh* returnatt = returMathod.GetAttribute(KXMLNameString); |
2066 |
2347 |
2067 baseMapIter->second.returnValueMatch = true; |
2348 if(Equals(basenameatt, bmethod.GetAttribute(KXMLNameString)) && |
2068 currMapIter->second.returnValueMatch = true; |
2349 Equals(basereturnatt, returnatt) && |
2069 break; |
2350 !Equals(basemangledatt, bmethod.GetAttribute(KXMLMangledString)) ) |
2070 } |
2351 { |
2071 |
2352 baseCount++;// overloaded function found in base |
2072 if( baseMapIter != baseMap.end() ) |
2353 break; |
2073 baseMapIter->second.signatureMatch = true; |
2354 } |
2074 currMapIter->second.signatureMatch = true; |
2355 } |
2075 //Check also the default parameter values |
2356 } |
2076 DOMElement * baselineelement = static_cast<DOMElement*>(basemethod.current); |
2357 |
2077 DOMNodeList* baselinechilds = baselineelement->getChildNodes(); |
2358 // Report the overloaded function only if it first time overloaded |
2078 DOMElement * currentelement = static_cast<DOMElement*>(currentmethod.current); |
2359 if(baseCount == 1) |
2079 DOMNodeList* currentchilds = currentelement->getChildNodes(); |
2360 { |
2080 |
2361 ret++; |
2081 XMLSize_t childcount = baselinechilds->getLength(); |
2362 if(report) |
2082 |
2363 { |
2083 unsigned int i = 0; |
2364 //add the issue as it is a binary compatibility break |
2084 for (i = 0; i < childcount; ++i) |
2365 AddIssue<EIssueIdentityExportedFunction,EIssueTypeOverload>(&basemethod, basemethod,lineNo,fileName); |
2085 { |
2366 } |
2086 DOMNode* baselinechild = baselinechilds->item(i); |
2367 } |
2087 HANodeIterator baselinechildit(baseline); |
2368 } |
2088 baselinechildit.current = baselinechild; |
2369 } |
2089 |
2370 }//end of base exported mathod loop |
2090 DOMNode* currentchild = currentchilds->item(i); |
|
2091 HANodeIterator currentchildit(current); |
|
2092 currentchildit.current = currentchild; |
|
2093 |
|
2094 short nodetype = baselinechildit->getNodeType(); |
|
2095 if (nodetype == DOMNode::ELEMENT_NODE) |
|
2096 { |
|
2097 const XMLCh * baselinesize = FindAttributeValueForType(baselinechildit,KXMLSizeString); |
|
2098 const XMLCh * currentsize = FindAttributeValueForType(currentchildit,KXMLSizeString); |
|
2099 |
|
2100 const XMLCh * baselinealign = FindAttributeValueForType(baselinechildit,KXMLAlignString); |
|
2101 const XMLCh * currentalign = FindAttributeValueForType(currentchildit,KXMLAlignString); |
|
2102 |
|
2103 if ( !baselinesize ) |
|
2104 { |
|
2105 baselinesize = baselinealign; |
|
2106 } |
|
2107 |
|
2108 if ( !currentsize ) |
|
2109 { |
|
2110 currentsize = currentalign; |
|
2111 } |
|
2112 |
|
2113 if ( !Equals(baselinesize,currentsize) || !Equals(baselinealign, currentalign) || |
|
2114 !CompareAttributes(baselinechildit,currentchildit,KXMLDefaultString,EOptionalSimpleAttribute)) |
|
2115 { |
|
2116 ++ret; |
|
2117 if (report) |
|
2118 { |
|
2119 AddIssueFunction<EIssueTypeParam>(&basemethod,identity,currentmethod,lineNo1); |
|
2120 } |
|
2121 break; |
|
2122 } |
|
2123 } |
|
2124 } |
|
2125 |
|
2126 // Check function return values |
|
2127 const ComparatorVector& cmps = ComparatorFactory::Instance().GetComparators(); |
|
2128 ComparatorVector::const_iterator retComparator = cmps.begin(); |
|
2129 int retComparatorRound = 1; |
|
2130 for ( ; retComparator != cmps.end(); retComparator++ ) |
|
2131 { |
|
2132 if ( compareMethodsReturn(basemethod,currentmethod, **retComparator) ) |
|
2133 { |
|
2134 if( retComparatorRound==CONSTFILTER_COMPARATOR ) |
|
2135 { |
|
2136 // if the return value has changed from const to non-const |
|
2137 ret++; |
|
2138 if(report) |
|
2139 { |
|
2140 //add the issue as it is a source compatibility break |
|
2141 AddIssueFunction<EIssueTypeReturnConst>(&basemethod,identity,currentmethod,lineNo1); |
|
2142 } |
|
2143 } |
|
2144 else if( retComparatorRound==CONSTFILTER2_COMPARATOR ) |
|
2145 { |
|
2146 // if the return calue has changed from non-const to const |
|
2147 ret++; |
|
2148 if(report) |
|
2149 { |
|
2150 //add the issue as it is a source compatibility break |
|
2151 AddIssueFunction<EIssueTypeReturnConst2>(&basemethod,identity,currentmethod,lineNo1); |
|
2152 } |
|
2153 } |
|
2154 |
|
2155 baseMapIter->second.returnValueMatch = true; |
|
2156 currMapIter->second.returnValueMatch = true; |
|
2157 break; |
|
2158 } |
|
2159 retComparatorRound++; |
|
2160 } |
|
2161 |
|
2162 |
|
2163 if ( !CheckAccessModifier(basemethod,currentmethod) ) |
|
2164 { |
|
2165 if (report) |
|
2166 { |
|
2167 AddIssueFunction<EIssueTypeAccess>(&basemethod,identity, currentmethod,lineNo1); |
|
2168 } |
|
2169 ++ret; |
|
2170 } |
|
2171 break; |
|
2172 } |
|
2173 } |
|
2174 } |
|
2175 else |
|
2176 { |
|
2177 // Not accessible, can be marked as matching. |
|
2178 if( baseMapIter != baseMap.end() ) |
|
2179 { |
|
2180 baseMapIter->second.signatureMatch = true; |
|
2181 baseMapIter->second.returnValueMatch = true; |
|
2182 } |
|
2183 } |
|
2184 } |
|
2185 |
2371 |
2186 // Recursive call with next comparator (if any) and updated method maps. |
2372 // Recursive call with next comparator (if any) and updated method maps. |
2187 const ComparatorVector& cmps = ComparatorFactory::Instance().GetComparators(); |
2373 const ComparatorVector& cmps = ComparatorFactory::Instance().GetComparators(); |
2188 if( ++comparator != cmps.end() ) |
2374 if( ++comparator != cmps.end() ) |
2189 { |
2375 { |
2245 |
2431 |
2246 int lineNo = 0; |
2432 int lineNo = 0; |
2247 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
2433 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
2248 lineNo = atoi(toString(lineNumber).c_str()); |
2434 lineNo = atoi(toString(lineNumber).c_str()); |
2249 |
2435 |
2436 string issueLoc; |
|
2437 const XMLCh* fnameNode = current.GetAttribute(KXMLFileIdString); |
|
2438 if(fnameNode != NULL) |
|
2439 { |
|
2440 HANodeIterator fileNode(current); |
|
2441 bool retval = fileNode.FindNodeById(fnameNode); |
|
2442 issueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
2443 } |
|
2444 |
|
2250 // If you don't like to see the issue about base size when the size has changed |
2445 // If you don't like to see the issue about base size when the size has changed |
2251 // uncomment the test below |
2446 // uncomment the test below |
2252 |
2447 |
2253 //if (!iReportAddedMembers) |
2448 //if (!iReportAddedMembers) |
2254 //{ |
2449 //{ |
2279 |
2474 |
2280 if ( bfields[i].iOffset != cfields[ii].iOffset ) |
2475 if ( bfields[i].iOffset != cfields[ii].iOffset ) |
2281 { |
2476 { |
2282 if (report) |
2477 if (report) |
2283 { |
2478 { |
2284 AddIssue<EIssueIdentityVirtualTablePointer,EIssueTypeOffset>(&baseline,current,lineNo,NULL,bfields[i]); |
2479 AddIssue<EIssueIdentityVirtualTablePointer,EIssueTypeOffset>(&baseline,current, |
2480 lineNo,issueLoc,NULL,bfields[i]); |
|
2285 } |
2481 } |
2286 ++ret; |
2482 ++ret; |
2287 } |
2483 } |
2288 break; |
2484 break; |
2289 } |
2485 } |
2314 |
2510 |
2315 if ( fieldAccessible[i] && !CheckAccessModifier(bfields[i].iAccess,cfields[ii].iAccess) ) |
2511 if ( fieldAccessible[i] && !CheckAccessModifier(bfields[i].iAccess,cfields[ii].iAccess) ) |
2316 { |
2512 { |
2317 if (report) |
2513 if (report) |
2318 { |
2514 { |
2319 AddIssue<EIssueIdentityField,EIssueTypeAccess>(&baseline, currentfield,cfields[ii].iLineNo,NULL,bfields[i]); |
2515 AddIssue<EIssueIdentityField,EIssueTypeAccess>(&baseline, currentfield,cfields[ii].iLineNo, |
2516 issueLoc,NULL,bfields[i]); |
|
2320 } |
2517 } |
2321 ++ret; |
2518 ++ret; |
2322 } |
2519 } |
2323 |
2520 |
2324 if ( 0 != compareField(baseline,current,bfields[i],cfields[ii],false) ) |
2521 if ( 0 != compareField(baseline,current,bfields[i],cfields[ii],false) ) |
2350 { |
2547 { |
2351 if ( !bfields[i].iNode ) |
2548 if ( !bfields[i].iNode ) |
2352 { |
2549 { |
2353 if (report) |
2550 if (report) |
2354 { |
2551 { |
2355 AddIssue<EIssueIdentityVirtualTablePointer,EIssueTypeRemoval>(&baseline,current,lineNo,NULL,bfields[i]); |
2552 AddIssue<EIssueIdentityVirtualTablePointer,EIssueTypeRemoval>(&baseline,current,lineNo, |
2553 issueLoc,NULL,bfields[i]); |
|
2356 } |
2554 } |
2357 continue; |
2555 continue; |
2358 } |
2556 } |
2359 |
2557 |
2360 HANodeIterator basefield(baseline); |
2558 HANodeIterator basefield(baseline); |
2364 { |
2562 { |
2365 if (report) |
2563 if (report) |
2366 { |
2564 { |
2367 if (fieldAccessible[i]) |
2565 if (fieldAccessible[i]) |
2368 { |
2566 { |
2369 AddIssue<EIssueIdentityField,EIssueTypeRemoval>(&baseline, basefield,lineNo,NULL,bfields[i]); |
2567 AddIssue<EIssueIdentityField,EIssueTypeRemoval>(&baseline, basefield,lineNo, |
2568 issueLoc,NULL,bfields[i]); |
|
2370 } |
2569 } |
2371 else |
2570 else |
2372 { |
2571 { |
2373 AddIssue<EIssueIdentityFieldInaccessible,EIssueTypeRemoval>(&baseline, basefield,lineNo,NULL,bfields[i]); |
2572 AddIssue<EIssueIdentityFieldInaccessible,EIssueTypeRemoval>(&baseline, basefield,lineNo, |
2573 issueLoc,NULL,bfields[i]); |
|
2374 } |
2574 } |
2375 } |
2575 } |
2376 ++ret; |
2576 ++ret; |
2377 } |
2577 } |
2378 } |
2578 } |
2407 { |
2607 { |
2408 if ( !cfields[i].iNode ) |
2608 if ( !cfields[i].iNode ) |
2409 { |
2609 { |
2410 if (report) |
2610 if (report) |
2411 { |
2611 { |
2412 AddIssue<EIssueIdentityVirtualTablePointer,EIssueTypeAddition>(&baseline,current,lineNo,NULL,cfields[i]); |
2612 AddIssue<EIssueIdentityVirtualTablePointer,EIssueTypeAddition>(&baseline,current,lineNo, |
2613 issueLoc,NULL,cfields[i]); |
|
2413 } |
2614 } |
2414 continue; |
2615 continue; |
2415 } |
2616 } |
2416 |
2617 |
2417 HANodeIterator currentfield(current); |
2618 HANodeIterator currentfield(current); |
2418 currentfield.current = cfields[i].iNode; |
2619 currentfield.current = cfields[i].iNode; |
2419 if (report && iReportAddedMembers) |
2620 if (report && iReportAddedMembers) |
2420 { |
2621 { |
2421 AddIssue<EIssueIdentityField,EIssueTypeAddition>(¤t, currentfield,cfields[i].iLineNo,NULL,cfields[i]); |
2622 AddIssue<EIssueIdentityField,EIssueTypeAddition>(¤t, currentfield,cfields[i].iLineNo, |
2623 issueLoc,NULL,cfields[i]); |
|
2422 } |
2624 } |
2423 ++ret; |
2625 ++ret; |
2424 } |
2626 } |
2425 } |
2627 } |
2426 return ret; |
2628 return ret; |
2521 const NodeIndex::vtable_t& basevtable = ClassGenerateVirtualTable(baseline); |
2723 const NodeIndex::vtable_t& basevtable = ClassGenerateVirtualTable(baseline); |
2522 const NodeIndex::vtable_t& currentvtable = ClassGenerateVirtualTable(current); |
2724 const NodeIndex::vtable_t& currentvtable = ClassGenerateVirtualTable(current); |
2523 |
2725 |
2524 int parentLineNo = 0; |
2726 int parentLineNo = 0; |
2525 int lineNo = 0; |
2727 int lineNo = 0; |
2728 string parentIssueLoc; |
|
2526 const XMLCh* parentlineNumber = current.GetAttribute(KXMLLineString); |
2729 const XMLCh* parentlineNumber = current.GetAttribute(KXMLLineString); |
2527 parentLineNo = atoi(toString(parentlineNumber).c_str()); |
2730 parentLineNo = atoi(toString(parentlineNumber).c_str()); |
2528 |
2731 const XMLCh* fnameNode = current.GetAttribute(KXMLFileIdString); |
2732 if(fnameNode != NULL) |
|
2733 { |
|
2734 HANodeIterator fileNode(current); |
|
2735 bool retval = fileNode.FindNodeById(fnameNode); |
|
2736 parentIssueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
2737 } |
|
2529 if ( 0 != compareVirtualTables(baseline,current,basevtable,currentvtable,report) ) |
2738 if ( 0 != compareVirtualTables(baseline,current,basevtable,currentvtable,report) ) |
2530 { |
2739 { |
2531 // Virtual table has been changed. |
2740 // Virtual table has been changed. |
2532 AddIssue<EIssueIdentityVirtualTable,EIssueTypeChange>(&baseline, current, parentLineNo, NULL, "[Primary-vtable]"); |
2741 AddIssue<EIssueIdentityVirtualTable,EIssueTypeChange>(&baseline, current, parentLineNo, |
2742 parentIssueLoc, NULL, "[Primary-vtable]"); |
|
2533 } |
2743 } |
2534 |
2744 |
2535 vector<pair<DOMNode*,int> > bvirtualMethodsWithIndex; |
2745 vector<pair<DOMNode*,int> > bvirtualMethodsWithIndex; |
2536 vector<pair<DOMNode*,int> > cvirtualMethodsWithIndex; |
2746 vector<pair<DOMNode*,int> > cvirtualMethodsWithIndex; |
2537 |
2747 |
2557 { |
2767 { |
2558 HANodeIterator currentmethod(current); |
2768 HANodeIterator currentmethod(current); |
2559 currentmethod.current = cvirtualMethodsWithIndex[ii].first; |
2769 currentmethod.current = cvirtualMethodsWithIndex[ii].first; |
2560 |
2770 |
2561 lineNo = 0; |
2771 lineNo = 0; |
2772 string issueLoc; |
|
2562 const XMLCh* lineNumber = currentmethod.GetAttribute(KXMLLineString); |
2773 const XMLCh* lineNumber = currentmethod.GetAttribute(KXMLLineString); |
2563 lineNo = atoi(toString(lineNumber).c_str()); |
2774 lineNo = atoi(toString(lineNumber).c_str()); |
2564 if ( compareMethodsSignature(basemethod,currentmethod, **defaultcomparator) ) |
2775 const XMLCh* fnameNode = currentmethod.GetAttribute(KXMLFileIdString); |
2776 if( fnameNode!= NULL) |
|
2777 { |
|
2778 HANodeIterator fileNode1(currentmethod); |
|
2779 bool retval = fileNode1.FindNodeById(fnameNode); |
|
2780 issueLoc = toString(fileNode1.GetAttribute(KXMLNameString)); |
|
2781 } |
|
2782 if ( compareMethodsSignature(basemethod,currentmethod, **defaultcomparator) ) |
|
2565 { |
2783 { |
2566 virtualMethodFound[ii] = true; |
2784 virtualMethodFound[ii] = true; |
2567 if (bvirtualMethodsWithIndex[i].second != cvirtualMethodsWithIndex[ii].second) |
2785 if (bvirtualMethodsWithIndex[i].second != cvirtualMethodsWithIndex[ii].second) |
2568 { |
2786 { |
2569 // Here the indexes don't match --> The order of virtual methods has been |
2787 // Here the indexes don't match --> The order of virtual methods has been |
2570 // changed. This means that the layout of the virtual table has been changed |
2788 // changed. This means that the layout of the virtual table has been changed |
2571 // and the binary compatibility is broken. |
2789 // and the binary compatibility is broken. |
2572 if (report) |
2790 if (report) |
2573 { |
2791 { |
2574 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeOrderChange>(&basemethod, currentmethod,lineNo); |
2792 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeOrderChange>(&basemethod, currentmethod, |
2793 lineNo,issueLoc); |
|
2575 } |
2794 } |
2576 ++ret; |
2795 ++ret; |
2577 } |
2796 } |
2578 |
2797 |
2579 //Check also the default parameter values |
2798 //Check also the default parameter values |
2612 if ( !currentsize ) |
2831 if ( !currentsize ) |
2613 { |
2832 { |
2614 currentsize = currentalign; |
2833 currentsize = currentalign; |
2615 } |
2834 } |
2616 |
2835 |
2617 if ( !Equals(baselinesize,currentsize) || !Equals(baselinealign, currentalign) || |
2836 if ( !Equals(baselinesize,currentsize) || !Equals(baselinealign, currentalign) ) |
2618 !CompareAttributes(baselinechildit,currentchildit,KXMLDefaultString,EOptionalSimpleAttribute)) |
|
2619 { |
2837 { |
2620 ++ret; |
2838 ++ret; |
2621 if (report) |
2839 if (report) |
2622 { |
2840 { |
2623 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeParam>(&basemethod,currentmethod, lineNo); |
2841 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeParam>(&basemethod,currentmethod, |
2842 lineNo,issueLoc); |
|
2843 } |
|
2844 break; |
|
2845 } |
|
2846 // if default value is changed then it should be reported as informative |
|
2847 if(!CompareAttributes(baselinechildit,currentchildit,KXMLDefaultString,EOptionalSimpleAttribute)) |
|
2848 { |
|
2849 ++ret; |
|
2850 if (report) |
|
2851 { |
|
2852 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeDefaultParam>(&basemethod,currentmethod, |
|
2853 lineNo,issueLoc); |
|
2624 } |
2854 } |
2625 break; |
2855 break; |
2626 } |
2856 } |
2627 } |
2857 } |
2628 } |
2858 } |
2629 // check the return types of the methods |
2859 // check the return types of the methods |
2630 if ( !compareMethodsReturn(basemethod,currentmethod,**defaultcomparator) ) |
2860 if ( !compareMethodsReturn(basemethod,currentmethod,**defaultcomparator) ) |
2631 { |
2861 { |
2632 if (report) |
2862 if (report) |
2633 { |
2863 { |
2634 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeReturn>(&basemethod, currentmethod,lineNo); |
2864 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeReturn>(&basemethod, currentmethod,lineNo,issueLoc); |
2635 } |
2865 } |
2636 ++ret; |
2866 ++ret; |
2637 } |
2867 } |
2638 |
2868 |
2639 if ( !CheckAccessModifier(basemethod,currentmethod) ) |
2869 if ( !CheckAccessModifier(basemethod,currentmethod) ) |
2640 { |
2870 { |
2641 if (report) |
2871 if (report) |
2642 { |
2872 { |
2643 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeAccess>(&basemethod, currentmethod,lineNo); |
2873 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeAccess>(&basemethod, currentmethod,lineNo,issueLoc); |
2644 } |
2874 } |
2645 ++ret; |
2875 ++ret; |
2646 } |
2876 } |
2647 break; |
2877 break; |
2648 } |
2878 } |
2672 } |
2902 } |
2673 else*/ |
2903 else*/ |
2674 { |
2904 { |
2675 if (report) |
2905 if (report) |
2676 { |
2906 { |
2677 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeRemoval>(&basemethod, basemethod,parentLineNo); |
2907 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeRemoval>(&basemethod, basemethod, |
2908 parentLineNo,parentIssueLoc); |
|
2678 } |
2909 } |
2679 ++ret; |
2910 ++ret; |
2680 } |
2911 } |
2681 } |
2912 } |
2682 } |
2913 } |
2687 { |
2918 { |
2688 HANodeIterator currentmethod(current); |
2919 HANodeIterator currentmethod(current); |
2689 currentmethod.current = cvirtualMethodsWithIndex[i].first; |
2920 currentmethod.current = cvirtualMethodsWithIndex[i].first; |
2690 |
2921 |
2691 lineNo = 0; |
2922 lineNo = 0; |
2923 string issueLoc; |
|
2692 const XMLCh* lineNumber = currentmethod.GetAttribute(KXMLLineString); |
2924 const XMLCh* lineNumber = currentmethod.GetAttribute(KXMLLineString); |
2693 lineNo = atoi(toString(lineNumber).c_str()); |
2925 lineNo = atoi(toString(lineNumber).c_str()); |
2926 const XMLCh* fnameNode = currentmethod.GetAttribute(KXMLFileIdString); |
|
2927 if( fnameNode!= NULL) |
|
2928 { |
|
2929 HANodeIterator fileNode1(currentmethod); |
|
2930 bool retval = fileNode1.FindNodeById(fnameNode); |
|
2931 issueLoc = toString(fileNode1.GetAttribute(KXMLNameString)); |
|
2932 } |
|
2694 //Check the base vtable for entry for this function |
2933 //Check the base vtable for entry for this function |
2695 unsigned int baseindex = cvirtualMethodsWithIndex[i].second; |
2934 unsigned int baseindex = cvirtualMethodsWithIndex[i].second; |
2696 |
2935 |
2697 if ( (baseindex < basevtable.size()) && (basevtable[baseindex].first == GenerateFunctionSignature(currentmethod)) ) |
2936 if ( (baseindex < basevtable.size()) && (basevtable[baseindex].first == GenerateFunctionSignature(currentmethod)) ) |
2698 { |
2937 { |
2699 //This is a new overwrite and we should report this if the class is derivable |
2938 // New rule is added for Q_OBJECT macro defining virtual functions. |
2700 if (ClassIsDerivable(baseline)) |
2939 // Do - add the Q_OBJECT macro to a class if the class already inherits from QObject , |
2940 // should not report as overridden. |
|
2941 if( basevtable[baseindex].first == __Q_OBJECT_METAOBJECT__ |
|
2942 || basevtable[baseindex].first == __Q_OBJECT_METACALL__ |
|
2943 || basevtable[baseindex].first == __Q_OBJECT_METACAST__ ) |
|
2701 { |
2944 { |
2945 } |
|
2946 else if(ClassIsDerivable(baseline)) |
|
2947 {//This is a new overwrite and we should report this if the class is derivable |
|
2702 if (report) |
2948 if (report) |
2703 { |
2949 { |
2704 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeNewOverride>(¤tmethod, currentmethod,lineNo); |
2950 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeNewOverride>(¤tmethod, currentmethod, |
2951 lineNo,issueLoc); |
|
2705 } |
2952 } |
2706 ++ret; |
2953 ++ret; |
2707 } |
2954 } |
2708 } |
2955 } |
2709 else |
2956 else |
2711 //This method really modifies the primary vtable |
2958 //This method really modifies the primary vtable |
2712 // If you also want to find out if this function overrides entry in vtable of non-primary base |
2959 // If you also want to find out if this function overrides entry in vtable of non-primary base |
2713 // then generate virtual table for them and search for the function signature from them |
2960 // then generate virtual table for them and search for the function signature from them |
2714 if (report) |
2961 if (report) |
2715 { |
2962 { |
2716 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeAddition>(¤tmethod, currentmethod,lineNo); |
2963 AddIssue<EIssueIdentityVirtualFunction,EIssueTypeAddition>(¤tmethod, currentmethod, |
2964 lineNo,issueLoc); |
|
2717 } |
2965 } |
2718 ++ret; |
2966 ++ret; |
2719 } |
2967 } |
2720 } |
2968 } |
2721 } |
2969 } |
2738 if ( (bbasesize) != (cbasesize) ) |
2986 if ( (bbasesize) != (cbasesize) ) |
2739 { |
2987 { |
2740 int lineNo = 0; |
2988 int lineNo = 0; |
2741 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
2989 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
2742 lineNo = atoi(toString(lineNumber).c_str()); |
2990 lineNo = atoi(toString(lineNumber).c_str()); |
2991 string issueLoc; |
|
2992 const XMLCh* fnameNode = current.GetAttribute(KXMLFileIdString); |
|
2993 if(fnameNode != NULL) |
|
2994 { |
|
2995 HANodeIterator fileNode(current); |
|
2996 bool retval = fileNode.FindNodeById(fnameNode); |
|
2997 issueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
2998 } |
|
2743 ++ret; |
2999 ++ret; |
2744 if (report) |
3000 if (report) |
2745 { |
3001 { |
2746 AddIssueClass<EIssueTypeBaseSize>(&baseline,iIdentity, current,lineNo); |
3002 AddIssueClass<EIssueTypeBaseSize>(&baseline,iIdentity, current,lineNo,issueLoc); |
2747 } |
3003 } |
2748 } |
3004 } |
2749 } |
3005 } |
2750 return ret; |
3006 return ret; |
2751 } |
3007 } |
2833 |
3089 |
2834 XMLSize_t baselinechildcount = baselinechilds->getLength(); |
3090 XMLSize_t baselinechildcount = baselinechilds->getLength(); |
2835 XMLSize_t currentchildcount = currentchilds->getLength(); |
3091 XMLSize_t currentchildcount = currentchilds->getLength(); |
2836 |
3092 |
2837 int lineNo = 0; |
3093 int lineNo = 0; |
3094 string issueLoc; |
|
2838 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
3095 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
2839 lineNo = atoi(toString(lineNumber).c_str()); |
3096 lineNo = atoi(toString(lineNumber).c_str()); |
3097 const XMLCh* fnameNode = current.GetAttribute(KXMLFileIdString); |
|
3098 if(fnameNode!= NULL) |
|
3099 { |
|
3100 HANodeIterator fileNode(current); |
|
3101 bool retval = fileNode.FindNodeById(fnameNode); |
|
3102 issueLoc = toString(fileNode.GetAttribute(KXMLNameString)); |
|
3103 } |
|
2840 if ( baselinechildcount == currentchildcount ) |
3104 if ( baselinechildcount == currentchildcount ) |
2841 { |
3105 { |
2842 unsigned int i = 0; |
3106 unsigned int i = 0; |
2843 for (i = 0; i < baselinechildcount; ++i) |
3107 for (i = 0; i < baselinechildcount; ++i) |
2844 { |
3108 { |
2869 if ( 0 != compareVirtualTables(basenameit,currentnameit,basevtable,currentvtable,report) ) |
3133 if ( 0 != compareVirtualTables(basenameit,currentnameit,basevtable,currentvtable,report) ) |
2870 { |
3134 { |
2871 string vtablename = "["; |
3135 string vtablename = "["; |
2872 vtablename += basename; |
3136 vtablename += basename; |
2873 vtablename += "-vtable]"; |
3137 vtablename += "-vtable]"; |
2874 AddIssue<EIssueIdentityVirtualTable,EIssueTypeChange>(&baseline, current, lineNo, NULL, vtablename); |
3138 AddIssue<EIssueIdentityVirtualTable,EIssueTypeChange>(&baseline, current, |
3139 lineNo, issueLoc,NULL, vtablename); |
|
2875 } |
3140 } |
2876 |
3141 |
2877 } |
3142 } |
2878 if ( |
3143 if ( |
2879 !Equals( baselineit.GetAttribute(KXMLVirtualString), currentit.GetAttribute(KXMLVirtualString)) ) |
3144 !Equals( baselineit.GetAttribute(KXMLVirtualString), currentit.GetAttribute(KXMLVirtualString)) ) |
2880 { |
3145 { |
2881 //Virtuality differs |
3146 //Virtuality differs |
2882 if (report) |
3147 if (report) |
2883 { |
3148 { |
2884 AddIssueClass<EIssueTypeInheritance>(&baseline,iIdentity, current,lineNo); |
3149 AddIssueClass<EIssueTypeInheritance>(&baseline,iIdentity, current,lineNo,issueLoc); |
2885 } |
3150 } |
2886 ++ret; |
3151 ++ret; |
2887 } |
3152 } |
2888 |
3153 |
2889 if ( !Equals( baselineit.GetAttribute(KXMLOffsetString), currentit.GetAttribute(KXMLOffsetString)) ) |
3154 if ( !Equals( baselineit.GetAttribute(KXMLOffsetString), currentit.GetAttribute(KXMLOffsetString)) ) |
2890 { |
3155 { |
2891 if (report) |
3156 if (report) |
2892 { |
3157 { |
2893 string subobjectname = "[" + basename; |
3158 string subobjectname = "[" + basename; |
2894 subobjectname += "]"; |
3159 subobjectname += "]"; |
2895 AddIssue<EIssueIdentitySubobject,EIssueTypeOffset>(&baseline,current,lineNo, NULL,subobjectname); |
3160 AddIssue<EIssueIdentitySubobject,EIssueTypeOffset>(&baseline,current,lineNo, |
3161 issueLoc,NULL,subobjectname); |
|
2896 } |
3162 } |
2897 ++ret; |
3163 ++ret; |
2898 } |
3164 } |
2899 break; |
3165 break; |
2900 } |
3166 } |
2905 { |
3171 { |
2906 //AddIssueClass<EIssueTypeInheritance>(&baseline,iIdentity, current); |
3172 //AddIssueClass<EIssueTypeInheritance>(&baseline,iIdentity, current); |
2907 //base class removed from inheritance |
3173 //base class removed from inheritance |
2908 string subobjectname = "[" + basename; |
3174 string subobjectname = "[" + basename; |
2909 subobjectname += "]"; |
3175 subobjectname += "]"; |
2910 AddIssue<EIssueIdentitySubobject,EIssueTypeRemoval>(&baseline,current,lineNo, NULL,subobjectname); |
3176 AddIssue<EIssueIdentitySubobject,EIssueTypeRemoval>(&baseline,current,lineNo,issueLoc,NULL,subobjectname); |
2911 } |
3177 } |
2912 ++ret; |
3178 ++ret; |
2913 } |
3179 } |
2914 } |
3180 } |
2915 } else |
3181 } else |
2916 { |
3182 { |
2917 //Different amount of bases |
3183 //Different amount of bases |
2918 if (report) |
3184 if (report) |
2919 { |
3185 { |
2920 AddIssueClass<EIssueTypeInheritance>(&baseline,iIdentity, current,lineNo); |
3186 AddIssueClass<EIssueTypeInheritance>(&baseline,iIdentity, current,lineNo,issueLoc); |
2921 } |
3187 } |
2922 ++ret; |
3188 ++ret; |
2923 |
3189 |
2924 //check if a base class is removed from inheritance |
3190 //check if a base class is removed from inheritance |
2925 unsigned int i = 0; |
3191 unsigned int i = 0; |
2951 { |
3217 { |
2952 if (report) |
3218 if (report) |
2953 { |
3219 { |
2954 string subobjectname = "[" + basename; |
3220 string subobjectname = "[" + basename; |
2955 subobjectname += "]"; |
3221 subobjectname += "]"; |
2956 AddIssue<EIssueIdentitySubobject,EIssueTypeRemoval>(&baseline,current,lineNo, NULL,subobjectname); |
3222 AddIssue<EIssueIdentitySubobject,EIssueTypeRemoval>(&baseline,current,lineNo,issueLoc,NULL,subobjectname); |
2957 } |
3223 } |
2958 ++ret; |
3224 ++ret; |
2959 } |
3225 } |
2960 } |
3226 } |
2961 } |
3227 } |
2997 |
3263 |
2998 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
3264 DOMNode* node = NodeAnalysis::findNode(baseline,current); |
2999 if ( !node ) |
3265 if ( !node ) |
3000 { |
3266 { |
3001 //AddIssue<>(&baseline,EIssue_class_removal); |
3267 //AddIssue<>(&baseline,EIssue_class_removal); |
3002 AddIssue<EIssueIdentityClass,EIssueTypeRemoval>(&baseline, baseline,0); |
3268 AddIssue<EIssueIdentityClass,EIssueTypeRemoval>(&baseline, baseline,0,""); |
3003 return 1; |
3269 return 1; |
3004 } |
3270 } |
3005 current.current = node; |
3271 current.current = node; |
3006 |
3272 |
3007 return this->Analyse(baseline,current); |
3273 return this->Analyse(baseline,current); |
3020 nodetype = current->getNodeType(); |
3286 nodetype = current->getNodeType(); |
3021 assert(nodetype == DOMNode::ELEMENT_NODE); |
3287 assert(nodetype == DOMNode::ELEMENT_NODE); |
3022 int lineNo = 0; |
3288 int lineNo = 0; |
3023 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
3289 const XMLCh* lineNumber = current.GetAttribute(KXMLLineString); |
3024 lineNo = atoi(toString(lineNumber).c_str()); |
3290 lineNo = atoi(toString(lineNumber).c_str()); |
3291 string issueLoc; |
|
3292 const XMLCh* fnameNode = current.GetAttribute(KXMLFileIdString); |
|
3293 if( fnameNode!= NULL) |
|
3294 { |
|
3295 HANodeIterator fileNode(current); |
|
3296 bool retval = fileNode.FindNodeById(fnameNode); |
|
3297 issueLoc =toString(fileNode.GetAttribute(KXMLNameString)); |
|
3298 } |
|
3025 |
3299 |
3026 const XMLCh* baseanalysisstatus = baseline.GetAttribute(KXMLBBCAnalysisStatus); |
3300 const XMLCh* baseanalysisstatus = baseline.GetAttribute(KXMLBBCAnalysisStatus); |
3027 |
3301 |
3028 if (baseanalysisstatus) |
3302 if (baseanalysisstatus) |
3029 { |
3303 { |
3067 { |
3341 { |
3068 ret = 0; |
3342 ret = 0; |
3069 } |
3343 } |
3070 else |
3344 else |
3071 { |
3345 { |
3072 AddIssueClass<EIssueTypeNotAnalysed>(&baseline,iIdentity, baseline,0); |
3346 AddIssueClass<EIssueTypeNotAnalysed>(&baseline,iIdentity, baseline,0,issueLoc); |
3073 ret = 1; |
3347 ret = 1; |
3074 } |
3348 } |
3075 } |
3349 } |
3076 else |
3350 else |
3077 { |
3351 { |
3079 // to more restricted. |
3353 // to more restricted. |
3080 if (!CheckAccessModifier(baseline,current)) |
3354 if (!CheckAccessModifier(baseline,current)) |
3081 { |
3355 { |
3082 if (report) |
3356 if (report) |
3083 { |
3357 { |
3084 AddIssueClass<EIssueTypeAccess>(&baseline,iIdentity, current,lineNo); |
3358 AddIssueClass<EIssueTypeAccess>(&baseline,iIdentity, current,lineNo,issueLoc); |
3085 } |
3359 } |
3086 ret += 1; |
3360 ret += 1; |
3087 } |
3361 } |
3088 |
3362 |
3089 |
3363 |
3090 // Check if the class has virtual bases |
3364 // Check if the class has virtual bases |
3091 if ( baseline.CheckForBooleanAttribute(KXMLBBCVirtualInheritanceString) ) |
3365 if ( baseline.CheckForBooleanAttribute(KXMLBBCVirtualInheritanceString) ) |
3092 { |
3366 { |
3093 AddIssueClass<EIssueTypeVirtualBases>(&baseline,iIdentity, current,lineNo); |
3367 AddIssueClass<EIssueTypeVirtualBases>(&baseline,iIdentity, current,lineNo,issueLoc); |
3094 ++ret; |
3368 ++ret; |
3095 } |
3369 } |
3096 |
3370 |
3097 if ( current.CheckForBooleanAttribute(KXMLBBCVirtualInheritanceString) ) |
3371 if ( current.CheckForBooleanAttribute(KXMLBBCVirtualInheritanceString) ) |
3098 { |
3372 { |
3099 AddIssueClass<EIssueTypeVirtualBases>(¤t,iIdentity, current,lineNo); |
3373 AddIssueClass<EIssueTypeVirtualBases>(¤t,iIdentity, current,lineNo,issueLoc); |
3100 ++ret; |
3374 ++ret; |
3101 } |
3375 } |
3102 |
3376 |
3103 // Check if the class is istantiable or derivable |
3377 // Check if the class is istantiable or derivable |
3104 if ( ClassIsInstantiable(baseline) || (ClassIsDerivable(baseline) && EIssueIdentityUnion != iIdentity) ) |
3378 if ( ClassIsInstantiable(baseline) || (ClassIsDerivable(baseline) && EIssueIdentityUnion != iIdentity) ) |
3106 |
3380 |
3107 if ( !CompareAttributes(baseline,current,KXMLAlignString,ESimpleAttribute) ) |
3381 if ( !CompareAttributes(baseline,current,KXMLAlignString,ESimpleAttribute) ) |
3108 { |
3382 { |
3109 if (report) |
3383 if (report) |
3110 { |
3384 { |
3111 AddIssueClass<EIssueTypeAlign>(&baseline,iIdentity, current,lineNo); |
3385 AddIssueClass<EIssueTypeAlign>(&baseline,iIdentity, current,lineNo,issueLoc); |
3112 iReportAddedMembers = true; |
3386 iReportAddedMembers = true; |
3113 } |
3387 } |
3114 ret += 1; |
3388 ret += 1; |
3115 } |
3389 } |
3116 |
3390 |
3117 if ( !CompareAttributes(baseline,current,KXMLSizeString,ESimpleAttribute) ) |
3391 if ( !CompareAttributes(baseline,current,KXMLSizeString,ESimpleAttribute) ) |
3118 { |
3392 { |
3119 if (report) |
3393 if (report) |
3120 { |
3394 { |
3121 AddIssueClass<EIssueTypeSize>(&baseline,iIdentity, current,lineNo); |
3395 AddIssueClass<EIssueTypeSize>(&baseline,iIdentity, current,lineNo,issueLoc); |
3122 iReportAddedMembers = true; |
3396 iReportAddedMembers = true; |
3123 } |
3397 } |
3124 ret += 1; |
3398 ret += 1; |
3125 } |
3399 } |
3126 } |
3400 } |