-
Notifications
You must be signed in to change notification settings - Fork 31
Finalize Type Definitions
This algorithm traverses the source model and finalizes the definitions of types.
-
A list tul of translation units.
-
An analysis data structure a representing the results of analysis so far. Evaluate Constant Expressions must have already been run.
-
The analysis a with an updated type map.
-
Visit each translation unit in tul with input a, yielding either a new analysis a' or an error.
Each method accepts an analysis data structure a as input and yields either a new analysis data structure a' or an error as output.
For each enum definition d that has not yet been visited, use the value map to compute the default value of d. Put the default value into the type.
For each array definition d that has not yet been visited:
-
Use the type map to look up the array type A associated with d.
-
Visit the anonymous array type A' in the array type A to update the members of A'.
-
Use the value map to fill in the size in A'.
-
Check that the size is greater than or equal to zero and less than or equal to the maximum allowed value.
-
If there is a default expression e
-
Ensure that its type matches the updated array type A.
-
Compute the value v of e at type A and let v be the default value.
-
-
Otherwise use the default value for A' to construct the default value.
-
Update the default value in the array type A.
-
Update the format specifier in the array type A and check the specifier for errors.
For each struct definition d that has not yet been visited:
-
Use the type map to look up the struct type S associated with d.
-
Visit the anonymous struct type S' in S to update the members of S'.
-
If there is a default expression e
-
Ensure that its type matches the updated struct type S.
-
Compute the value v of e at type S and let v be the default value.
-
-
Otherwise use the default value for S' to construct the default value.
-
Update the default value in the struct type S.
-
Update the format specifiers in the struct type S and check the specifiers for errors.