Skip to content

Commit

Permalink
Add usage initialization for pointers of objects
Browse files Browse the repository at this point in the history
  • Loading branch information
IDKWNTCMF committed Aug 9, 2023
1 parent 3969dee commit 062a1b2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/src/Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ void KTestObjectParser::assignTypeUnnamedVar(
Tests::MethodParam param = {fieldType.baseTypeObj(1), "", std::nullopt};
order.emplace(indObj, param, curType.paramValue);
visited[indObj] = true;
usages[indObj] = types::PointerUsage::PARAMETER;
}
}
}
Expand Down Expand Up @@ -716,14 +717,17 @@ size_t KTestObjectParser::getOffsetInStruct(Tests::TypeAndVarName &objTypeAndNam
objTypeAndName.type = objTypeAndName.type.baseTypeObj();
size_t sizeInBits = typesHandler.typeSize(objTypeAndName.type);
size_t offset = offsetInBits / sizeInBits;
offsetInBits %= sizeInBits;
if (objTypeAndName.varName.empty()) {
return offsetInBits;
}
std::string indices;
while (dimension != 0) {
size_t index = offset % sizes[--dimension];
offset /= sizes[dimension];
indices = StringUtils::stringFormat("[%d]%s", index, indices);
}
objTypeAndName.varName += indices;
offsetInBits %= sizeInBits;
return offsetInBits;
}

Expand Down

0 comments on commit 062a1b2

Please sign in to comment.