Commits

Jordan Rose committed be12d86dddf
Turn ClangModule into ClangModuleUnit. Part of the FileUnit restructuring. A Clang module (whether from a framework or a simple collection of headers) is now imported as a TranslationUnit containing a single ClangModuleUnit. One wrinkle in all this is that Swift very much wants to do searches on a per-module basis, but Clang can only do lookups across the entire TranslationUnit. Unless and until we get a better way to deal with this, we're stuck with an inefficiency here. Previously, we used to hack around this by ignoring the "per-module" bit and only performing one lookup into all Clang modules, but that's not actually correct with respect to visibility. Now, we're just taking the filtering hit for looking up a particular name, and caching the results when we look up everything (for code completion). This isn't ideal, but it doesn't seem to be costing too much in performance, at least not right now, and it means we can get visibility correct. In the future, it might make sense to include a ClangModuleUnit alongside a SerializedASTFile for adapter modules, rather than having two separate modules with the same name. I haven't really thought through this yet, though. Swift SVN r10834