Commits

Jordan Rose committed 490aefafcd3
[ClangImporter] Preserve macros from all implicit submodules. (#3983) ...instead of picking one definition arbitrarily. This comes from the new "lookup table" design in Swift 3---we no longer just look for any "visible" (imported) macro definition, but instead need to know them up front. This works fine when there's only one definition per module, but for modules like 'OpenGL' on macOS, with mutually-exclusive submodules 'GL' and 'GL3', the compiler was arbitrarily deciding that all of the macros the submodules had in common belonged to 'GL'. The new model tries to decide if it's possible for two modules to be imported separately, and keeps both macro entries if possible, only deduplicating equivalent definitions at the last minute (when importing into Swift). This /still/ doesn't perfectly match the behavior you'd get in C, where a submodule and its parent module could theoretically have conflicting definitions and you'd be fine as long as you only imported one of them, but hopefully (a) it's close enough, and (b) nobody is doing that. (The Swift compiler will prefer the definition in the parent module even if the submodule is the only one imported.) rdar://problem/26731529