<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 21, 2017, at 8:58 PM, Marc-André Laperle <<a href="mailto:marc-andre.laperle@ericsson.com" class="">marc-andre.laperle@ericsson.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class="">Hi Alex,</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Thanks a lot for doing this! I think what you're proposing sounds very good. Just a few questions.</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">- Have you given some thoughts on how to handle refactorings in the presence or inactive preprocessor directives? For example, renaming a symbol that is also referenced in an inactive section. I don't know if it's already something that is handled by clang-rename? That might mean having the concept of "potential matches" that the user would have to review and unselect. Otherwise, To get fully accurate semantic renaming, it would mean having the index built for all possible configurations and query all configurations during the rename, which seems excessive.<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>I think we could probably use textual in the inactive code blocks and report textual occurrences to the user (that won’t be renamed by default, so the user will have to explicitly approve them). Clang currently doesn't find such occurrences at all, but Swift can. Although Swift doesn’t use a preprocessor, its `#if` directives can still produce inactive code blocks (that are parsed but not type checked). I believe for such cases Swift simply uses textual search inside the inactive code blocks. Clang’s “global rename" could do something similar. We would have to record the skipped PP ranges while indexing first (we currently don’t store them) and then feed them into the global renaming engine.</div><br class=""><blockquote type="cite" class=""><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">- You mentioned a few times that the refactoring support would be indexer-agnostic and that any external indexer could be used. That lead me to wonder if it was ever considered in the past to put Xcode's indexer in the Clang codebase? Since Clangd will have to implement its own (although reusing some lib/Index things), I think that it would be ideal to collaborate on the same one. I<span class="Apple-converted-space"> </span><br class=""></div>bring this up because it seems to me that it's the only missing bigger piece in an otherwise pretty complete solution.<br class=""></div></div></div></blockquote><div><br class=""></div><div>I don't know the answer to this question. Argyrios or Duncan are probably the right people for it.</div><br class=""><blockquote type="cite" class=""><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Cheers,</div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Marc-André<br class=""></div></div><hr tabindex="-1" style="display: inline-block; width: 738.90625px;" class=""><div id="divRplyFwdMsg" dir="ltr" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span><a href="mailto:aleksei_lorenz@apple.com" class="">aleksei_lorenz@apple.com</a> <<a href="mailto:aleksei_lorenz@apple.com" class="">aleksei_lorenz@apple.com</a>> on behalf of Alex Lorenz <<a href="mailto:aleksei_lorenz@apple.com" class="">aleksei_lorenz@apple.com</a>><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Thursday, June 15, 2017 7:57:14 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>clang developer list<br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span>Duncan P. N. Exon Smith; Vedant Kumar; Argyrios Kyrtzidis; Ben Langmuir; Marc-André Laperle; <a href="mailto:klimek@google.com" class="">klimek@google.com</a>; <a href="mailto:kramerb@google.com" class="">kramerb@google.com</a><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>[RFC] Adding refactoring support to Clang</font><div class=""> </div></div><div class=""><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Hi,</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">This is a proposal for a new Clang-based refactoring engine (as indicated by Duncan last week<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">[</span>1<span class="" style="color: rgb(149, 126, 53);">]</span>). The new refactoring engine should be based on both the existing code from<span class="Apple-converted-space"> </span><a href="http://llvm.org/" class="" id="LPlnk786023" previewremoved="true">llvm.org</a><span class="Apple-converted-space"> </span>and the code that I've just committed to<span class="Apple-converted-space"> </span><a href="http://github.com/apple/swift-clang" class="" id="LPlnk863344" previewremoved="true">github.com/apple/swift-clang</a><span class="" style="color: rgb(149, 126, 53);">[</span>2<span class="" style="color: rgb(149, 126, 53);">]</span><span class="Apple-converted-space"> </span>(Please note that it has some outdated designs and APIs that I'd like to replace). This email is split into three different sections:</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>The first section lists the refactoring actions supported by Xcode 9.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>The second section describes the actual proposal.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>The third section outlines an action plan that I would like to follow when submitting patches for the new refactoring engine.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">I'm looking forward to any feedback that you might have!</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 25px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">#<span class="Apple-converted-space"> </span></span>Background</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">At first I would like to provide a little bit of background on the C++/Objective-C refactorings in Xcode. Xcode 9 contains a Clang-based refactoring engine that supports several refactoring operations. The primary operation that it supports is “Rename”. The refactoring engine gathers the renamed symbol occurrences using two distinct mechanisms:</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Local rename. It gathers occurrences for declarations that are declared in a function's body. It is based on existing code from<span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-rename</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>that was moved over to Clang's<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">Tooling</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>library. It was then modified slightly to fit our goals. I also added support for some Objective-C declarations.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Global rename. It gathers occurrences for all other declarations. We decided to put the high-level logic for global rename into Xcode's indexer because Xcode had to support cross-language rename (between Swift and Objective-C). The indexer uses the core engine in Clang’s lib/Index, so Clang is still very much involved in this process. The indexer also delegates low-level “indexed-file” renames to Clang. This lets us gather occurrences for symbolic references that don't have the full location information (like Objective-C selector names), textual matches for occurrences of a matching string in comments, and textual matches for a matching filename in the<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">#include</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>directives.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Xcode 9 also support some local refactoring actions:</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Extract function/method.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Extract duplicate expression.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Add missing switch cases (GIF:<span class="Apple-converted-space"> </span><a href="https://reviews.llvm.org/file/data/q2qz53jd7ug4cpx4zlfx/PHID-FILE-aq75y26bgkfvm5e775jt/switchCases" class="" id="LPlnk292524" previewremoved="true">https://reviews.llvm.org/file/data/q2qz53jd7ug4cpx4zlfx/PHID-FILE-aq75y26bgkfvm5e775jt/switchCases</a>). It is also available as a fixit.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>[C++] Fill-in method stubs from abstract base classes.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Convert if to switch.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>[ObjC] Fill in protocol stubs. It is also available as a fixit.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>[ObjC] Wrap in NSLocalizedString</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Another action that Xcode supports is called “Generate Missing Function Definitions” (GIF:<a href="https://reviews.llvm.org/file/data/u4kzt62wjdin5dpl65jl/PHID-FILE-w7jl2vz42b5aybd6oizj/generateFunctionDefinitions" class="" id="LPlnk376924" previewremoved="true">https://reviews.llvm.org/file/data/u4kzt62wjdin5dpl65jl/PHID-FILE-w7jl2vz42b5aybd6oizj/generateFunctionDefinitions</a>). This action actually depends on the indexer to determine the set of methods that have to be implemented and where should the generated code go. It’s also the one and only cross-TU refactoring action that is currently supported (without taking "rename" into account).</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 25px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">#<span class="Apple-converted-space"> </span></span>Refactoring Engine Proposal</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">I would like to create a new refactoring engine that will go into Clang's<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">Tooling</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>library. The engine's API should be designed with different use cases in mind, and I would like to ensure that the engine accommodates the following three use cases:</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Libclang. It should provide a C-based refactoring API that we can use in Xcode.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Clangd.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>A standalone refactoring tool,<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-refactor</span><span class="" style="color: rgb(149, 126, 53);">`</span>. This tool will be used for testing. It will also allow users to perform refactoring actions without using other tools.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">The engine should try to follow the following high level goals:</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>It should be easy for others to create, test, and integrate new local refactoring operations.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Refactoring operations should be allowed to fail. The engine should have good error reporting mechanisms.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Initiation via source selection should be quick (if we assume that we have access to a parsed AST) as we'd like to let a user know which actions are available as soon as possible.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>The engine should allow at least a basic level of configurability and customization (users should be able select options for a refactoring action if an action chooses to provide some). In the future we might also want to provide more powerful configuration mechanisms that will allow IDEs to generate custom UIs for different actions.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 19px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">##<span class="Apple-converted-space"> </span></span>Initiation</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">I think that there are two equally important modes of initiation that should be supported by Clang's refactoring engine:</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Initiation via source selection. This mode is important for IDEs.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Initiation via AST queries. This mode is important for standalone tools / scripts that want to refactor an entire project.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Unfortunately our code doesn't provide a good enough abstraction that generalizes well for different actions. I'm still hashing out a better initiation scheme, and I will send a separate RFC with our proposal for initiation in the near future. Let me know if you have any ideas/suggestions!</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 19px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">##<span class="Apple-converted-space"> </span></span>Refactoring</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">I would like to propose keeping the two modes that were previously described for the "Rename" operation. This will probably mean that a standalone tool like<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-refactor</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>won't support the global rename mode of rename. On the other hand, if Clangd will gain some form of indexing infrastructure (which seems likely given the recent interest in indexing<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">[</span>3<span class="" style="color: rgb(149, 126, 53);">]</span>), it will be able to use the engine's global renaming infrastructure as well. I'm hoping the community will provide some input on what should happen to<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-rename</span><span class="" style="color: rgb(149, 126, 53);">`</span>, as I'm not sure whether it should stay or be deprecated in favour of new tools.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Other refactoring operations will primarily work with source modifications. I think that the refactoring engine should provide a set of shared utility components that can be reused by different operations. For example, things like return type deduction for extracted declarations should be accessible to all operations. This kind of design should also make testing easier.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Certain refactoring actions (e.g. "Fill-in switch cases") work well together with diagnostic fix-its, as they can be presented in an editor and a user can initiate a refactoring operation using a UI that's already familiar to them. I would like to ensure that this kind of mechanism is accessible to refactoring operations that need it. Our current code contains two actions that are implemented in the<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">Edit</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>library. They're usable from<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">Sema</span><span class="" style="color: rgb(149, 126, 53);">`</span>, and we take advantage of that to generate the fix-its during semantic analysis.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 19px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">##<span class="Apple-converted-space"> </span></span>Cross-TU Operations & Indexer Queries</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">The majority of refactoring actions that we've implemented perform source transformations in a single translation unit (TU). However, there are some actions that need to work across TU boundaries. Xcode 9 includes one such cross-TU action - “Generate Missing Function Definitions”. A naïve cross-TU solution that I've looked at initially was based on an API that had a series of callbacks between Xcode's indexer and libclang. However, I quickly discovered that this model didn't work that well, as it interfered with the code that loaded and handled different TUs in the indexer.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Note: while "Rename" is a global operation, it doesn't actually interact with other TUs because source replacements can be derived from the data stored in the project's index. Thus, our implementation doesn't treat it as a cross-TU operation.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">The current implementation of the “Generate Missing Function Definitions" action is based on the "refactoring continuations" API. A refactoring continuation is just a suspended refactoring operation that can be executed in a TU that's different to the one in which the operation was created. Each continuation includes TU-specific state that's automatically managed by Clang, as well as a set of questions about that state. Each individual question is called an "indexer query".</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Indexer queries are the core structures that enable cross-TU actions. An external component (like Xcode's indexer) has to evaluate them before running the continuation in order for the operation to work correctly. Each query can be described using four different attributes:</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Question: The kind of question that should be answered. Our implementation exposes the following two kinds at the libclang level:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">Decl_FileThatShouldImplement</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">Decl_IsDefined</span><span class="" style="color: rgb(149, 126, 53);">`</span>.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Subject: The TU-specific state from the parent continuation that acts as the question's subject.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Result: The value that has to be set by the external indexer component before running the refactoring continuation.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Action: A flag that represents an additional action that has to be performed by the indexer before running the continuation. We use the<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">RunContinuationInTUThatHasThisFile</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>action in Xcode's indexer to determine which TU should be loaded and used when running the refactoring continuation.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Please note that while I mention "Xcode's indexer" quite a lot in this section, our refactoring continuation API is indexer-agnostic, and is designed to work with any indexer. The indexer just has to implement support for the indexer queries that are required for a particular refactoring operation, and the refactoring engine handles everything else. The code sample below shows how our code constructs the refactoring continuation for the "Generate Missing Function Definitions" action:</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">```</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);">return continueInExternalASTUnit(</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);">/*Indexer query that gets annotated with the RunContinuationInTUThatHasThisFile action */ fileThatShouldContainImplementationOf(Container),</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);">/*Pointer to the continuation function*/ runInImplementationAST,</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);">/*A state value*/ Container,</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);">/*An additional indexer query over some state*/ filter(llvm::makeArrayRef(SelectedMethods), [](const DeclEntity &D) { return !D.isDefined(); }));</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">```</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">In practical terms, the following series of events occur in Xcode when it performs the “Generate Missing Function Definitions” operation:</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>After the user chooses the "Generate Missing Function Definitions” action, Xcode notifies its indexer that it has to perform that action. The indexer then uses libclang to get the refactoring results after running the action's operation in the initiation TU.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Xcode's indexer sees that the results provide a refactoring continuation instead of source replacements, so it starts looking at the attached indexer queries.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Xcode's indexer evaluates each query by looking at the question's kind and the TU-specific state (A set of<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">CXCursor</span><span class="" style="color: rgb(149, 126, 53);">`</span>s). It sends back the result to libclang using a set of query-agnostic routines that consume different data types.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>After evaluating the queries, Xcode's indexer loads the TU in which the refactoring continuation should run. It knows which TU it has to load by looking at the result of the query that included the<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">RunContinuationInTUThatHasThisFile</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>action flag.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Xcode's indexer then invokes the refactoring continuation in the freshly loaded TU. Clang converts the continuation's state from previously serialized TU-independent state to a state that's specific to the new TU, and continues running the refactoring operation with this state.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Xcode's indexer then receives the source replacements produced by the refactoring operation and passes them back to Xcode so that it can apply the replacements to the source.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">I would like to propose an API model that's based on our current "refactoring continuations" API for the cross-TU operations in the new refactoring engine. Clang will provide a C++ API that can be used in a way that's similar to the code presented above. It will also manage all of the interactions with libclang and Clangd, so individual refactoring operations won't have to worry about the fine details of a particular indexer. Furthermore, the new refactoring engine will limit the set of available actions based on the set of queries that are supported by an indexer, so the indexer that chooses to support refactoring continuations won't have to support all of the queries.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 19px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">##<span class="Apple-converted-space"> </span></span>Testing & Tooling</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">The<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-refactor</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>tool will be used to test the refactoring engine. I would like to propose the following action-agnostic command line interface:</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">```</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);">clang-refactor <action> [options] <initiation file> [additional build options]</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">```</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">I think that the tool should use comment-based annotations in the test source files to control things like initiation. For example, given a selection annotation<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">// selection: +1:1 -> +2:12</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>on line 12,<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-refactor</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>will map it to a selection range of 13:1 -> 14:12 and will initiate a certain refactoring action using that selection.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">In addition to<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-refactor</span><span class="" style="color: rgb(149, 126, 53);">`</span>, I would also like to provide an additional stress-test tool that will work with entire projects (using compilation databases), and will be capable of:</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Initiating/performing refactoring actions at each token in all of the source files in a project.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Verifying the consistency between the indexer and the refactoring engine to ensure that they have the same model of the source.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">This tool will also come with a script that generates compilation databases for Clang's tests.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">I also have a great little reviewing tool that helps others to visualize the refactoring changes for a particular action, and I'd be more than happy to share it if you're interested. The tool generates a set of HTML pages that contain the sources of the refactoring tests. The pages get annotated to show the changes that were made during refactoring. We found that looking at this visualization instead of the raw<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">CHECK</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>lines makes reviewers' life much easier.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 25px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">#<span class="Apple-converted-space"> </span></span>Action Plan</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Initially I would like to adopt the following high-level plan for the creation of the new refactoring engine:</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Upstream any non-refactoring specific changes from our code.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Move the core of<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-rename</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>over to clang (<span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-rename</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>should still work as before).</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Start working on the<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-refactor</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>tool so that it can use the previously moved code. Move the tests from<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-rename</span><span class="" style="color: rgb(149, 126, 53);">`</span>over to Clang and convert them to<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-refactor</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>tests.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Submit our changes to the core of the<span class="Apple-converted-space"> </span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="" style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);">clang-rename</span><span class="" style="color: rgb(149, 126, 53);">`</span><span class="Apple-converted-space"> </span>engine.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Create and test the new global rename component.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Create an AST source selection component. Initiation via source selection will be based on this component.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Create a refactoring initiation API that will be easy to use.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Start submitting our local refactoring actions.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Start working on the libclang API.</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">-</span><span class="Apple-converted-space"> </span>Create and submit everything else that remains, e.g. Cross-TU Operations & Indexer Queries.</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Cheers,</div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; background-color: rgb(255, 255, 255);">Alex</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(19, 55, 255); background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">[</span><span class="" style="">1</span><span class="" style="color: rgb(149, 126, 53);">]:</span><span class="" style=""><span class="Apple-converted-space"> </span></span><a href="http://lists.llvm.org/pipermail/cfe-dev/2017-June/054108.html" class="" id="LPlnk990923" previewremoved="true">http://lists.llvm.org/pipermail/cfe-dev/2017-June/054108.html</a></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(19, 55, 255); background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">[</span><span class="" style="">2</span><span class="" style="color: rgb(149, 126, 53);">]:</span><span class="" style=""><span class="Apple-converted-space"> </span></span><a href="https://github.com/apple/swift-clang/commit/9890adfbee8f854732d0093bc8b2a32be1be8844" class="" id="LPlnk247598" previewremoved="true">https://github.com/apple/swift-clang/commit/9890adfbee8f854732d0093bc8b2a32be1be8844</a></div><div class="" style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(19, 55, 255); background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(149, 126, 53);">[</span><span class="" style="">3</span><span class="" style="color: rgb(149, 126, 53);">]:</span><span class="" style=""><span class="Apple-converted-space"> </span></span><a href="http://lists.llvm.org/pipermail/cfe-dev/2017-May/053869.html" class="" id="LPlnk499736" previewremoved="true">http://lists.llvm.org/pipermail/cfe-dev/2017-May/053869.html</a></div></div></div></div></blockquote></div><br class=""></body></html>