]> granicus.if.org Git - clang/commit
[Modules] Allow @import to reach submodules in private module maps
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Wed, 2 May 2018 02:25:03 +0000 (02:25 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Wed, 2 May 2018 02:25:03 +0000 (02:25 +0000)
commita05f37359b23be7c068e19968c8f106edf6f2b34
tree40d23eb15f955337ef09ea9372de8cccfac3370c
parentbb709adc10d4ab4d9f46457e0a5b82f84d2cbc94
[Modules] Allow @import to reach submodules in private module maps

A @import targeting a top level module from a private module map file
(@import Foo_Private), would fail if there's any submodule declaration
around (module Foo.SomeSub) in the same private module map.

This happens because compileModuleImpl, when building Foo_Private, will
start with the private module map and will not parse the public one,
which leads to unsuccessful parsing of Foo.SomeSub, since top level Foo
was never parsed.

Declaring other submodules in the private module map is not common and
should usually be avoided, but it shouldn't fail to build. Canonicalize
compileModuleImpl to always look at the public module first, so that all
necessary information is available when parsing the private one.

rdar://problem/39822328

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331322 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Frontend/CompilerInstance.cpp
test/Modules/Inputs/submodule-in-private-mmap/A.framework/Headers/A.h [new file with mode: 0644]
test/Modules/Inputs/submodule-in-private-mmap/A.framework/Headers/SomeSub.h [new file with mode: 0644]
test/Modules/Inputs/submodule-in-private-mmap/A.framework/Modules/module.modulemap [new file with mode: 0644]
test/Modules/Inputs/submodule-in-private-mmap/A.framework/Modules/module.private.modulemap [new file with mode: 0644]
test/Modules/Inputs/submodule-in-private-mmap/A.framework/PrivateHeaders/APrivate.h [new file with mode: 0644]
test/Modules/submodule-in-private-mmap.m [new file with mode: 0644]