<div dir="ltr">Oh, remembered I had one other question/idea:<br><br>Tangentially related to the question about non-inline functions in headers:<br><br>Currently .pcm files have the 'interesting decls' list. Are there any interesting decls once modules codegen is in use? It seems mostly the interesting decls are things like non-inline functions (& perhaps global variables - I haven't got to those yet & I think I remember you mentioning they might be trickier due to ordering requirements?). If not, we could perhaps repurpose the interesting decls list as the modular codegen decls list - but then we'd need a flag to say "actually, we're doing modular codegen for this module". So perhaps having it as a separate list provides the same functionality & is clearer anyway.<br><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 17, 2017 at 8:08 PM David Blaikie via Phabricator via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">dblaikie created this revision.<br class="gmail_msg">
<br class="gmail_msg">
First pass at generating weak definitions of inline functions from module files<br class="gmail_msg">
(& currently skipping definitions of those functions in uses)<br class="gmail_msg">
<br class="gmail_msg">
I've done some manual testing (haven't delved into the preferred testing<br class="gmail_msg">
strategy for modules). Seems to work for simplest cases, including transitive<br class="gmail_msg">
modules.<br class="gmail_msg">
<br class="gmail_msg">
Also doesn't have an actual flag plumbed through, yet. I can submit that ahead<br class="gmail_msg">
of this in a separate patch (open to ideas, etc). Is there a goal for how<br class="gmail_msg">
explicit modules should be used via the driver (rather than cc1)? Otherwise<br class="gmail_msg">
this would be a cc1 option to match.<br class="gmail_msg">
<br class="gmail_msg">
One quandry: What to do with non-inline definitions in headers? Currently this<br class="gmail_msg">
prototype moves their emission (while keeping their linkage) to the module<br class="gmail_msg">
object. This would remove ODR violations and actually make it 'correct' to<br class="gmail_msg">
define a non-inline function in a header, which may or may not be desirable. It<br class="gmail_msg">
could be kept in all the users as it is today.<br class="gmail_msg">
<br class="gmail_msg">
I'm sure I don't know nearly enough about linkage and about how linkage is<br class="gmail_msg">
handled in Clang & LLVM. So I'm certainly open to ideas about how this<br class="gmail_msg">
implementation isn't ideal or correct - or the myriad of interesting linkage<br class="gmail_msg">
cases I should test/consider.<br class="gmail_msg">
<br class="gmail_msg">
Perhaps we could chat about this in person/over the shoulder if a faster<br class="gmail_msg">
iteration would be worthwhile.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D28845" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D28845</a><br class="gmail_msg">
<br class="gmail_msg">
Files:<br class="gmail_msg">
  include/clang/AST/ASTContext.h<br class="gmail_msg">
  include/clang/AST/ExternalASTSource.h<br class="gmail_msg">
  include/clang/Basic/LangOptions.def<br class="gmail_msg">
  include/clang/Basic/Module.h<br class="gmail_msg">
  include/clang/Serialization/ASTBitCodes.h<br class="gmail_msg">
  include/clang/Serialization/ASTReader.h<br class="gmail_msg">
  include/clang/Serialization/ASTWriter.h<br class="gmail_msg">
  lib/AST/ASTContext.cpp<br class="gmail_msg">
  lib/AST/ExternalASTSource.cpp<br class="gmail_msg">
  lib/Basic/Module.cpp<br class="gmail_msg">
  lib/CodeGen/CodeGenModule.cpp<br class="gmail_msg">
  lib/Lex/ModuleMap.cpp<br class="gmail_msg">
  lib/Serialization/ASTReader.cpp<br class="gmail_msg">
  lib/Serialization/ASTWriter.cpp<br class="gmail_msg">
  lib/Serialization/ASTWriterDecl.cpp<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
cfe-commits mailing list<br class="gmail_msg">
<a href="mailto:cfe-commits@lists.llvm.org" class="gmail_msg" target="_blank">cfe-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="gmail_msg">
</blockquote></div></div>