Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make qual_handling enum for canonicalize() public #649

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/aro/Type.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1138,12 +1138,18 @@ pub fn alignof(ty: Type, comp: *const Compilation) u29 {
};
}

// This enum should be kept public because it is used by the downstream zig translate-c
pub const QualHandling = enum {
standard,
preserve_quals,
};

/// Canonicalize a possibly-typeof() type. If the type is not a typeof() type, simply
/// return it. Otherwise, determine the actual qualified type.
/// The `qual_handling` parameter can be used to return the full set of qualifiers
/// added by typeof() operations, which is useful when determining the elemType of
/// arrays and pointers.
pub fn canonicalize(ty: Type, qual_handling: enum { standard, preserve_quals }) Type {
pub fn canonicalize(ty: Type, qual_handling: QualHandling) Type {
var cur = ty;
if (cur.specifier == .attributed) {
cur = cur.data.attributed.base;
Expand Down
Loading