<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi, Seth. Sorry for not getting back to you sooner! I don't think we have anything exactly like this, but there's <i class="">sort</i>&nbsp;of a sequence diagram in Chris and Joe's talk at the LLVM conference, "<a href="https://youtu.be/Ntj8ab-5cvE" class="">Swift's High-Level IR</a>". I'd say it looks something like this:</div><div class=""><br class=""></div><div class="">1. Parsing</div><div class="">2. Semantic analysis, including type-checking</div><div class="">3. SIL generation</div><div class="">4. Mandatory SIL passes</div><div class="">5. SIL optimization</div><div class="">6. LLVM IR generation</div><div class="">7. LLVM optimization</div><div class="">8. LLVM output (usually including machine code generation and writing to a .o file)</div><div class=""><br class=""></div><div class="">…with the last two handled pretty much completely by&nbsp;<a href="http://llvm.org" class="">LLVM</a>&nbsp;itself, and not customized by Swift.</div><div class=""><br class=""></div><div class="">We probably ought to have something like Clang's "<a href="http://clang.llvm.org/docs/InternalsManual.html" class="">Internals</a>" manual (hopefully better), which lays out the major concepts in each library. As it is we have various concepts that are documented very well, either in docs/ or in header comments, and others which are just arcane knowledge in the heads of the implementers. This is not a good thing.</div><div class=""><br class=""></div><div class="">The "<a href="https://swift.org/contributing/" class="">Contributing</a>" page on the website lists a handful of ways to get involved; another one we're still bringing up is issues with the "StarterBug" label in JIRA. These are intended to be bugs that a newcomer could use as a goal-oriented way to learn about one part of the project.</div><div class=""><br class=""></div><div class="">Of course, we're happy to answer any specific questions you might have (and this list is probably the right place for them). It's the general ones that are hard. :-)</div><div class=""><br class=""></div><div class="">Jordan</div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 16, 2015, at 2:36, Seth Friedman &lt;<a href="mailto:sethfri@gmail.com" class="">sethfri@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="white-space:pre-wrap" class="">Thanks Jordan!<br class=""><br class="">Another question if anyone has some time: I'm really interested in contributing to the project, but given that I don't have a ton of experience with compilers, I'm having a really hard time following the flow of the program. I understand that the high level flow is lexing, parsing, sema, and building the AST. However, tracing through the actual functions in the compiler prove much more difficult due to the amount of indirection/metaprogramming.<br class=""><br class="">Are there any sort of sequence diagrams that I haven't found yet? If anyone could let me know of any good resources you know of, that would be great. I'm sure this would also be of use to people in my boat that want to help but don't know how to start.<br class=""><br class="">Thanks,<br class="">Seth</div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Dec 8, 2015 at 9:04 PM Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">Hi, Seth. I think you're getting Clang / swift-clang mixed up with swiftc / swift. Clang is not the Swift compiler; the Swift compiler lives in the "swift" repo. Swift depends on Clang for its interoperation with C and Objective-C.</div><div class=""><br class=""></div><div class="">A <i class="">lot</i>&nbsp;of the compiler encodes information about Optional, but most of it stems from ASTContext.h and ASTContext.cpp, which has dedicated entrypoints for getting Optional, Optional.None, and Optional.Some.</div><div class=""><br class=""></div><div class="">Hope this helps,</div><div class="">Jordan</div><br class=""><div class=""><blockquote type="cite" class=""></blockquote></div></div><div style="word-wrap:break-word" class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 8, 2015, at 17:59 , Seth Friedman via swift-dev &lt;<a href="mailto:swift-dev@swift.org" target="_blank" class="">swift-dev@swift.org</a>&gt; wrote:</div><br class=""></blockquote></div></div><div style="word-wrap:break-word" class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="white-space:pre-wrap" class="">Hi all,<br class=""><br class="">In Optional.swift in the stdlib, there's a comment that says "The compiler has special knowledge of Optional&lt;Wrapped&gt;, including the fact that it is an enum with cases named 'None' and 'Some'."<br class=""><br class="">What I'm trying to understand is: If I wanted to implement the optional type from scratch, what would be the process I would go through? I've scoured the swift-clang project and can't seem to find any reference to optionals or even Swift explicitly. I discovered nullability attributes and am hypothesizing that an expression of something like "Type?" is somehow mapped to an attribute, but I'm really just stumbling around in the dark.<br class=""><br class="">In terms of what I've tried, I've gone through a lot of the source in the swift-clang lib/Basic and lib/AST directories, and I've read through the "Clang CFE Internals Manual" on the Clang website.<br class=""><br class="">Help is much appreciated!<br class=""><br class="">Thanks in advance,<br class="">Seth</div>
</div></blockquote></div></div><div style="word-wrap:break-word" class=""><div class=""><blockquote type="cite" class=""><div class=""><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ZEz4qHYnXhPr3bBPu-2FxP4tN3HfWKL-2FtJpqkQ0gkOVSBL6HRSS2hzpFojqZUT85ho4HsE-2FB0XLWrcqkyvQBO5xufppQ8uPgxEwiKwgl62G3z1r-2BUiBJC1BXFFOiAgFN8sYiuSJIgxPeG9oDjBYl-2BjYeGhsvoyyj8qwRtpVhGMN6onwcfLODiw-2B-2FRXFdKLIXbuUSf1FU50IqzQBipBXcb37O1Np08nQCz4e4XNzuhG5HY-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important" class="">
_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" target="_blank" class="">swift-dev@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a><br class=""></div></blockquote></div><br class=""></div></blockquote></div>
</div></blockquote></div><br class=""></body></html>