GP-5038 Support for data-type recursion through typedef

This commit is contained in:
caheckman 2024-10-28 20:44:52 +00:00
parent 6d5a5da013
commit 2e09cf4ef3
6 changed files with 75 additions and 23 deletions

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -115,7 +115,7 @@ public record AttributeId(String name, int id) {
public static final AttributeId ATTRIB_CHAR = new AttributeId("char", 49);
public static final AttributeId ATTRIB_CORE = new AttributeId("core", 50);
public static final AttributeId ATTRIB_ENUM = new AttributeId("enum", 51);
// public static final AttributeId ATTRIB_ENUMSIGNED = new AttributeId("enumsigned", 52); // deprecated
public static final AttributeId ATTRIB_INCOMPLETE = new AttributeId("incomplete", 52);
// public static final AttributeId ATTRIB_ENUMSIZE = new AttributeId("enumsize", 53); // deprecated
// public static final AttributeId ATTRIB_INTSIZE = new AttributeId("intsize", 54); // deprecated
// public static final AttributeId ATTRIB_LONGSIZE = new AttributeId("longsize", 55); // deprecated

View file

@ -799,12 +799,12 @@ public class PcodeDataTypeManager {
}
/**
* Encode a Structure to the stream that has its size reported as zero.
* Encode a Structure/Union to the stream without listing its fields
* @param encoder is the stream encoder
* @param type data type to encode
* @throws IOException for errors in the underlying stream
*/
public void encodeCompositeZeroSizePlaceholder(Encoder encoder, DataType type)
public void encodeCompositePlaceholder(Encoder encoder, DataType type)
throws IOException {
String metaString;
if (type instanceof Structure) {
@ -820,7 +820,9 @@ public class PcodeDataTypeManager {
encoder.writeString(ATTRIB_NAME, type.getDisplayName());
encoder.writeUnsignedInteger(ATTRIB_ID, progDataTypes.getID(type));
encoder.writeString(ATTRIB_METATYPE, metaString);
encoder.writeSignedInteger(ATTRIB_SIZE, 0);
encoder.writeSignedInteger(ATTRIB_SIZE, type.getLength());
encoder.writeSignedInteger(ATTRIB_ALIGNMENT, type.getAlignment());
encoder.writeBool(ATTRIB_INCOMPLETE, true);
encoder.closeElement(ELEM_TYPE);
}