[clang][modules] Disallow importing private framework in the implementation
authorJan Svoboda <jan_svoboda@apple.com>
Fri, 20 Jan 2023 01:02:42 +0000 (17:02 -0800)
committerJan Svoboda <jan_svoboda@apple.com>
Fri, 20 Jan 2023 21:37:36 +0000 (13:37 -0800)
commitc3efd52770ca964ba46287298c1d2f7697fd446c
treeba336fee3953bfb00a7c8bbacb6764b85a415770
parent743fbcb79d9af759377df5f5929ffdd38ff52b09
[clang][modules] Disallow importing private framework in the implementation

Whenever we are compiling implementation of a framework (with the `-fmodule-name=FW` option), we never translate `#import <FW/Header.h>` to an import, regardless of whether "Header.h" belongs to "FW" or "FW_Private". For the same reasons, we also disallow `@import FW`. However, we still allow `@import FW_Private`. This patch disallows that a well, to be consistent with the rest of the rules.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D142167
clang/include/clang/Basic/Module.h
clang/lib/Basic/Module.cpp
clang/lib/Lex/PPDirectives.cpp
clang/lib/Sema/SemaModule.cpp
clang/test/Modules/implementation-of-module-private.m [new file with mode: 0644]