<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Feb 24, 2015, at 6:28 PM, Adrian Prantl <<a href="mailto:aprantl@apple.com" class="">aprantl@apple.com</a>> wrote:<br class=""><blockquote type="cite" class="">You are correct. I need to remove the use of PCHGenerator from ModuleContainerGenerator.<br class=""></blockquote><blockquote type="cite" class=""><blockquote type="cite" class="">On Feb 24, 2015, at 6:11 PM, NAKAMURA Takumi <<a href="mailto:geek4civic@gmail.com" class="">geek4civic@gmail.com</a>> wrote:<br class="">It still has circular dependencies between clangCodeGen and clangFrontend.<br class=""></blockquote></blockquote><div class=""><br class=""></div><div class="">After some deliberation, I noticed that there is actually more to be done here in order to resolve the cyclic dependencies. Here is a graph of (a simplified subset of) the dependencies after this commit:</div><div class=""><div class="">- Pretty much all of CodeGen depends on CodeGenOptions, which is currently part of Frontend.<br class="">- BackendUtil and CodeGenAction depend on both CodeGen and Frontend.<br class="">- CodeGenModuleContainer introduces a cyclic dependency between Frontend and CodeGen.<br class=""><br class=""></div><div class=""><img apple-inline="yes" id="A7403826-A02D-48EE-8EF2-F760887CE216" height="252" width="775" apple-width="yes" apple-height="yes" src="cid:D194D893-1FF0-4701-BC81-3FBA493F4344@apple.com" class=""></div><div class=""><br class=""></div><div class=""><div class="">The above cycle can be resolved by reversing the CodeGen->Frontend dependency and splitting out the common dependencies CodeGenOptions and frontend::utils::BuryPointer into a separate library that I’m calling FrontendSupport for lack of a better name. After this, the only remaining CodeGen->Frontend dependencies are CodeGen/BackendUtil.cpp and CodeGen/CodeGenAction.cpp:</div><div class="">- CodeGenAction looks like it could safely be moved into FrontendTool, which is its only user.</div><div class="">- BackendUtil can stay were it is, it is needed by CodeGenAction and (via CodeGenModuleContainer) by Frontend. The dependency on Frontend can be eliminated by splitting BuryPointer out from Utils.</div><div class="">The new picture then looks like this:</div><div class="">  </div><div class=""><img apple-inline="yes" id="9530D0FE-EA2C-4296-AA65-123650561D36" height="289" width="775" apple-width="yes" apple-height="yes" src="cid:E575061C-D0B9-4E10-AAE1-20613B941FC6@apple.com" class=""></div><div class=""><br class=""></div><div class="">I’ll try and implement it this way; hopefully I didn’t miss any other edges in the graph.</div><div class="">-- adrian</div><div class=""><br class=""><blockquote type="cite" class=""><br class="">thanks for noticing!<br class="">-- adrian<br class=""></blockquote><br class=""></div></div></div></body></html>