<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi, Richard. Jordan's back with another annoying ModuleMacro question for Swift. Let's say I have these two modules:<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">module Conflicting {</div><div class=""> explicit module A { header "ConflictingA.h" }</div><div class=""> explicit module B { header "ConflictingB.h" }</div><div class="">}</div><div class=""><br class=""></div><div class="">module Redefined {</div><div class=""> module A { header "RedefinedA.h" }</div><div class=""> module B { header "RedefinedB.h" }</div><div class="">}</div></blockquote><div class=""><br class=""></div><div class="">Both headers in 'Conflicting' define a macro CONFLICTING, but with different values; a client is only supposed to import one of them. 'Redefined' is a little different: RedefinedB.h includes RedefinedA.h before defining the new value, and the client is probably going to import the entire top-level module. Let's say RedefinedB.h is even polite enough to use #undef.*</div><div class=""><br class=""></div><div class="">* If these examples sound bad, well, I agree, but the former is what the OpenGL framework on macOS has been doing for years, and the latter is how Clang's limits.h deals with a system limits.h.</div><div class=""><br class=""></div><div class="">The question: using ModuleMacro, <b class="">how can I distinguish these two cases</b> while building a PCM?</div><div class=""><br class=""></div><div class="">The obvious correct Clang answer is "don't bother, visibility will handle everything when the modules get imported", but unfortunately that doesn't fly for Swift, because of this third example:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">module CrossModuleRedefinedCore {</div><div class=""> header "CrossModuleRedefinedCore.h"</div><div class="">}</div><div class="">module CrossModuleRedefined {</div><div class=""> // imports CrossModuleRedefinedCore</div><div class=""> header "CrossModuleRedefined.h"</div><div class="">}</div></blockquote><br class=""><div class="">In Swift, I'm allowed to say `CrossModuleRedefinedCore.REDEFINED` to get the old value, and `CrossModuleRedefined.REDEFINED` to get the new value. I'm not <i class="">hugely</i> concerned about this use case if I can get the other two to work well, but I haven't given up on it yet.</div><div class=""><br class=""></div><div class="">Any ideas? I already tried looking at the overrides, but that seems like it's represented the same in both cases.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Jordan</div></body></html>