Skip to content

runtime: namespace SmallVectorImpl for inline namespace #31759

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 1 commit into from
May 13, 2020

Conversation

compnerd
Copy link
Member

This adjusts the use of SmallVectorImpl to allow the runtime to use
inline namespaces for its local copy of LLVMSupport.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

This adjusts the use of `SmallVectorImpl` to allow the runtime to use
inline namespaces for its local copy of LLVMSupport.
@compnerd
Copy link
Member Author

CC: @mikeash @jckarter

@compnerd
Copy link
Member Author

@swift-ci please test

@jckarter
Copy link
Contributor

jckarter commented May 13, 2020

Instead of using an inline namespace, can we alter the Swift versions of these templates to live in the swift namespace rather than llvm? I think it's better to make it clear we're using vendored versions of these templates than play tricks to make it look like they're the same as the original LLVM declarations.

@compnerd
Copy link
Member Author

The inline namespace is a prefix of __swift::__runtime::. So the final qualified name is __swift::__runtime::llvm::ArrayRef etc. The reason for the inline namespace is to avoid change all the sites. This becomes more useful for the shared headers across the compiler and the runtime, where the namespace is going to remain llvm:: (unless we completely fork LLVM).

@compnerd
Copy link
Member Author

Going to merge this for now; if I've misunderstood what you were recommending, I can do the changes in a follow up.

@compnerd compnerd merged commit f7df8e7 into swiftlang:master May 13, 2020
@compnerd compnerd deleted the shared-inline-spaces branch May 13, 2020 21:28
@jckarter
Copy link
Contributor

"Change all the sites" is what I was trying to suggest. How prevalent do the affected types show up in shared runtime/compiler code? I'd be concerned about divergent behavior between Swift and LLVM causing really subtle hard-to-track-down problems. When we've vendored LLVM templates previously like TrailingObjects, we've intentionally re-namespaced them to make the distinction clear.

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