@@ -280,7 +280,7 @@ shared_ptr<StructValueView> KTestObjectParser::structView(const vector<char> &by
280
280
PointerUsage usage,
281
281
const std::optional<const Tests::MethodDescription> &testingMethod,
282
282
const std::string &name,
283
- const std::optional< MapAddressName> &fromAddressToName,
283
+ const MapAddressName &fromAddressToName,
284
284
std::vector<InitReference> &initReferences) {
285
285
vector<shared_ptr<AbstractValueView>> subViews;
286
286
unsigned int curPos = offset;
@@ -342,13 +342,13 @@ shared_ptr<StructValueView> KTestObjectParser::structView(const vector<char> &by
342
342
case TypeKind::OBJECT_POINTER:
343
343
res = readBytesAsValueForType (byteArray, PointerWidthType, curPos + offsetField,
344
344
PointerWidthSize);
345
- if (fromAddressToName.has_value ()) {
346
- if (fromAddressToName-> find ( std::stoull (res)) != fromAddressToName-> end ()) {
347
- initReferences. emplace_back ( PrinterUtils::getFieldAccess (name, field. name ), fromAddressToName-> at (std::stoull (res)));
348
- }
345
+ if (fromAddressToName.find ( std::stoull (res)) != fromAddressToName. end ()) {
346
+ initReferences. emplace_back ( PrinterUtils::getFieldAccess (name, field. name ),
347
+ fromAddressToName. at (std::stoull (res)));
348
+ res = PrinterUtils::C_NULL;
349
349
}
350
- subViews. push_back (std::make_shared<JustValueView>( PrinterUtils::initializePointer (
351
- field.type .typeName (), res)));
350
+
351
+ subViews. push_back (std::make_shared<JustValueView>( PrinterUtils::initializePointer ( field.type .typeName (), res)));
352
352
break ;
353
353
case TypeKind::FUNCTION_POINTER:
354
354
subViews.push_back (functionPointerView (curStruct.name , field.name ));
@@ -606,8 +606,8 @@ void KTestObjectParser::assignTypeUnnamedVar(Tests::MethodTestCase &testCase,
606
606
607
607
testCase.lazyVariables .emplace_back (curVar.type , name);
608
608
shared_ptr<AbstractValueView> testParamView = testParameterView ({name, byteValue}, {paramType, name},
609
- PointerUsage::PARAMETER, methodDescription ,
610
- testCase.fromAddressToName , testCase. lazyReferences );
609
+ PointerUsage::PARAMETER, testCase. fromAddressToName ,
610
+ testCase.lazyReferences , methodDescription );
611
611
testCase.lazyValues .emplace_back (testCase.objects [curVar.num ].name , 0 , testParamView);
612
612
}
613
613
@@ -778,13 +778,14 @@ KTestObjectParser::parseTestCaseParams(const UTBotKTest &ktest,
778
778
auto paramType = methodParam.type .maybeJustPointer () ? methodParam.type .baseTypeObj () : methodParam.type ;
779
779
if (CollectionUtils::containsKey (methodDescription.functionPointers , methodParam.name )) {
780
780
testParamView = testParameterView (
781
- emptyKleeParam, { paramType, methodParam.name }, PointerUsage::PARAMETER, methodDescription ,
782
- testCaseDescription.fromAddressToName , testCaseDescription. lazyReferences );
781
+ emptyKleeParam, { paramType, methodParam.name }, PointerUsage::PARAMETER, testCaseDescription. fromAddressToName ,
782
+ testCaseDescription.lazyReferences , methodDescription );
783
783
} else {
784
784
const auto kleeParam = getKleeParamOrThrow (rawKleeParams, methodParam.name );
785
785
786
- testParamView = testParameterView (kleeParam, {paramType, methodParam.name }, PointerUsage::PARAMETER, methodDescription,
787
- testCaseDescription.fromAddressToName , testCaseDescription.lazyReferences );
786
+ testParamView = testParameterView (kleeParam, {paramType, methodParam.name }, PointerUsage::PARAMETER,
787
+ testCaseDescription.fromAddressToName , testCaseDescription.lazyReferences ,
788
+ methodDescription);
788
789
}
789
790
testCaseDescription.funcParamValues .push_back (
790
791
{ methodParam.name , methodParam.alignment , testParamView });
@@ -805,7 +806,9 @@ KTestObjectParser::parseTestCaseParams(const UTBotKTest &ktest,
805
806
auto paramType = methodDescription.returnType .maybeReturnArray () ? methodDescription.returnType :
806
807
methodDescription.returnType .baseTypeObj ();
807
808
const Tests::TypeAndVarName returnParam = { paramType, KleeUtils::RESULT_VARIABLE_NAME };
808
- const auto testReturnView = testParameterView (kleeResParam, returnParam, PointerUsage::RETURN, methodDescription);
809
+ const auto testReturnView = testParameterView (kleeResParam, returnParam, PointerUsage::RETURN,
810
+ testCaseDescription.fromAddressToName , testCaseDescription.lazyReferences ,
811
+ methodDescription);
809
812
testCaseDescription.returnValue = {
810
813
KleeUtils::RESULT_VARIABLE_NAME, types::TypesHandler::isObjectPointerType (methodDescription.returnType ), testReturnView
811
814
};
@@ -818,13 +821,15 @@ KTestObjectParser::parseTestCaseParams(const UTBotKTest &ktest,
818
821
const auto kleePathFlagSymbolicIterator = getKleeParam (rawKleeParams, KLEE_PATH_FLAG_SYMBOLIC);
819
822
if (kleePathFlagSymbolicIterator != rawKleeParams.end ()) {
820
823
const Tests::TypeAndVarName kleePathParam = {types::Type::intType (), KLEE_PATH_FLAG_SYMBOLIC};
821
- const auto kleePathFlagSymbolicView = testParameterView (*kleePathFlagSymbolicIterator, kleePathParam, types::PointerUsage::PARAMETER);
824
+ const auto kleePathFlagSymbolicView = testParameterView (*kleePathFlagSymbolicIterator, kleePathParam, types::PointerUsage::PARAMETER,
825
+ testCaseDescription.fromAddressToName , testCaseDescription.lazyReferences );
822
826
testCaseDescription.kleePathFlagSymbolicValue = {KLEE_PATH_FLAG_SYMBOLIC, false , kleePathFlagSymbolicView};
823
827
}
824
828
const auto functionReturnNotNullIterator = getKleeParam (rawKleeParams, KleeUtils::NOT_NULL_VARIABLE_NAME);
825
829
if (functionReturnNotNullIterator != rawKleeParams.end ()) {
826
830
const Tests::TypeAndVarName functionReturnNotNull = {types::Type::intType (), KleeUtils::NOT_NULL_VARIABLE_NAME};
827
- const auto functionReturnNotNullView = testParameterView (*functionReturnNotNullIterator, functionReturnNotNull, types::PointerUsage::PARAMETER);
831
+ const auto functionReturnNotNullView = testParameterView (*functionReturnNotNullIterator, functionReturnNotNull, types::PointerUsage::PARAMETER,
832
+ testCaseDescription.fromAddressToName , testCaseDescription.lazyReferences );
828
833
testCaseDescription.functionReturnNotNullValue = {KleeUtils::NOT_NULL_VARIABLE_NAME, false , functionReturnNotNullView};
829
834
}
830
835
return testCaseDescription;
@@ -835,13 +840,15 @@ void KTestObjectParser::processGlobalParamPreValue(Tests::TestCaseDescription &t
835
840
vector<RawKleeParam> &rawKleeParams) {
836
841
string kleeParamName = globalParam.name ;
837
842
auto kleeParam = getKleeParamOrThrow (rawKleeParams, kleeParamName);
838
- auto testParamView = testParameterView (kleeParam, { globalParam.type , globalParam.name }, types::PointerUsage::PARAMETER);
843
+ auto testParamView = testParameterView (kleeParam, { globalParam.type , globalParam.name }, types::PointerUsage::PARAMETER,
844
+ testCaseDescription.fromAddressToName , testCaseDescription.lazyReferences );
839
845
testCaseDescription.globalPreValues .emplace_back ( globalParam.name , globalParam.alignment , testParamView );
840
846
}
841
847
842
848
void KTestObjectParser::processSymbolicStdin (Tests::TestCaseDescription &testCaseDescription, vector<RawKleeParam> &rawKleeParams) {
843
849
auto &&read = getKleeParamOrThrow (rawKleeParams, " stdin-read" );
844
- string &&view = testParameterView (read, {types::Type::longlongType (), " stdin-read" }, types::PointerUsage::PARAMETER)->getEntryValue ();
850
+ string &&view = testParameterView (read, {types::Type::longlongType (), " stdin-read" }, types::PointerUsage::PARAMETER,
851
+ testCaseDescription.fromAddressToName , testCaseDescription.lazyReferences )->getEntryValue ();
845
852
if (view == " 0LL" ) {
846
853
return ;
847
854
} else {
@@ -865,7 +872,8 @@ void KTestObjectParser::processGlobalParamPostValue(Tests::TestCaseDescription &
865
872
auto kleeParam = getKleeParamOrThrow (rawKleeParams, symbolicVariable);
866
873
auto type = typesHandler.getReturnTypeToCheck (globalParam.type );
867
874
Tests::TypeAndVarName typeAndVarName{ type, globalParam.name };
868
- auto testParamView = testParameterView (kleeParam, typeAndVarName, types::PointerUsage::PARAMETER);
875
+ auto testParamView = testParameterView (kleeParam, typeAndVarName, types::PointerUsage::PARAMETER,
876
+ testCaseDescription.fromAddressToName , testCaseDescription.lazyReferences );
869
877
testCaseDescription.globalPostValues .emplace_back ( globalParam.name , globalParam.alignment , testParamView );
870
878
}
871
879
@@ -878,7 +886,8 @@ void KTestObjectParser::processParamPostValue(Tests::TestCaseDescription &testCa
878
886
types::Type paramType = param.type .arrayCloneMultiDim (usage);
879
887
auto type = typesHandler.getReturnTypeToCheck (paramType);
880
888
Tests::TypeAndVarName typeAndVarName{ type, param.name };
881
- auto testParamView = testParameterView (kleeParam, typeAndVarName, usage);
889
+ auto testParamView = testParameterView (kleeParam, typeAndVarName, usage, testCaseDescription.fromAddressToName ,
890
+ testCaseDescription.lazyReferences );
882
891
testCaseDescription.paramPostValues .emplace_back ( param.name , param.alignment , testParamView );
883
892
}
884
893
@@ -894,30 +903,21 @@ void KTestObjectParser::processStubParamValue(Tests::TestCaseDescription &testCa
894
903
}
895
904
auto type = typesHandler.getReturnTypeToCheck (methodNameToReturnTypeMap.at (methodName));
896
905
Tests::TypeAndVarName typeAndVarName{ type, kleeParam.paramName };
897
- auto testParamView = testParameterView (kleeParam, typeAndVarName, types::PointerUsage::PARAMETER);
906
+ auto testParamView = testParameterView (kleeParam, typeAndVarName, types::PointerUsage::PARAMETER,
907
+ testCaseDescription.fromAddressToName , testCaseDescription.lazyReferences );
898
908
testCaseDescription.stubValues .emplace_back ( kleeParam.paramName , 0 , testParamView );
899
909
testCaseDescription.stubValuesTypes .emplace_back (type, kleeParam.paramName , 0 );
900
910
}
901
911
}
902
912
}
903
913
904
- shared_ptr<AbstractValueView> KTestObjectParser::testParameterView (
905
- const RawKleeParam &kleeParam,
906
- const Tests::TypeAndVarName ¶m,
907
- types::PointerUsage usage,
908
- const std::optional<const Tests::MethodDescription> &testingMethod,
909
- const std::optional<MapAddressName> &fromAddressToName) {
910
- std::vector<InitReference> tmp;
911
- return testParameterView (kleeParam, param, usage, testingMethod, fromAddressToName, tmp);
912
- }
913
-
914
914
shared_ptr<AbstractValueView> KTestObjectParser::testParameterView (
915
915
const KTestObjectParser::RawKleeParam &kleeParam,
916
916
const Tests::TypeAndVarName ¶m,
917
917
PointerUsage usage,
918
- const std::optional< const Tests::MethodDescription> &testingMethod ,
919
- const std::optional<MapAddressName > &fromAddressToName ,
920
- std::vector<InitReference > &initReferences ) {
918
+ const MapAddressName &fromAddressToName ,
919
+ std::vector<InitReference > &initReferences ,
920
+ const std::optional< const Tests::MethodDescription > &testingMethod ) {
921
921
EnumInfo enumInfo;
922
922
StructInfo structInfo;
923
923
UnionInfo unionInfo;
0 commit comments