Skip to content

Add ConstString initializer to ArrayType #105

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

Merged
merged 3 commits into from
Sep 19, 2017
Merged

Conversation

vdka
Copy link
Contributor

@vdka vdka commented Sep 19, 2017

This PR adds an initializer to create a constant string using

ArrayType.constant(string: "asdf")

It wraps LLVMConstStringInContext

Copy link
Member

@harlanhaskins harlanhaskins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM mod the comment nit

@@ -31,6 +31,18 @@ public struct ArrayType: IRType {
}
}

/// Creates a constant array value of i8 from a swift string.
///
/// - parameter string: A string to create a null terminated array from.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you be explicit about this being the UTF-8 bytes of the string?

Copy link
Contributor Author

@vdka vdka Sep 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creates a constant, null terminated array value of utf8 bytes from string's utf8 member.

Good?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use “UTF-8” for the first one and surround the 2nd utf8 in code voice and we’re good.

@vdka vdka merged commit 7fc4caf into llvm-swift:master Sep 19, 2017
@vdka vdka deleted the const-string branch September 19, 2017 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants