aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2022-09-22 11:31:31 -0700
committerJan Svoboda <jan_svoboda@apple.com>2022-09-22 12:06:02 -0700
commit9dc0b1674841243110f95cdc9c9d97bcf30c1544 (patch)
treef2a202e6c4334ca78391ac6db4a604543000114f /clang/lib/Lex/ModuleMap.cpp
parent38b20a02fe6798e9788dc012910784255500f427 (diff)
downloadllvm-9dc0b1674841243110f95cdc9c9d97bcf30c1544.zip
llvm-9dc0b1674841243110f95cdc9c9d97bcf30c1544.tar.gz
llvm-9dc0b1674841243110f95cdc9c9d97bcf30c1544.tar.bz2
[clang][deps] Report module map describing compiled module
This patch fixes compilation failure with explicit modules caused by scanner not reporting the module map describing the module whose implementation is being compiled. Below is a breakdown of the attached test case. Note the VFS that makes frameworks "A" and "B" share the same header "shared/H.h". In non-modular build, Clang skips the last import, since the "shared/H.h" header has already been included. During scan (or implicit build), the compiler handles "tu.m" as follows: * `@import B` imports module "B", as expected, * `#import <A/H.h>` is resolved textually (due to `-fmodule-name=A`) to "shared/H.h" (due to the VFS remapping), * `#import <B/H.h>` is resolved to import module "A_Private", since the header "shared/H.h" is already known to be part of that module, and the import is skipped. In the end, the only modular dependency of the TU is "B". In explicit modular build without `-fmodule-name=A`, TU does depend on module "A_Private" properly, not just textually. Clang therefore builds & loads its PCM, and knows to ignore the last import, since "shared/H.h" is known to be part of "A_Private". But with current scanner behavior and `-fmodule-name=A` present, the last import fails during explicit build. Clang doesn't know about "A_Private" (it's included textually) and tries to import "B_Private" instead, which it doesn't know about either (the scanner correctly didn't report it as dependency). This is fixed by reporting the module map describing "A" and matching the semantics of implicit build. Reviewed By: Bigcheese Differential Revision: https://reviews.llvm.org/D134222
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
0 files changed, 0 insertions, 0 deletions