llvm-capstone/clang/test/Modules/implicit-map-dot-private.m
Jan Svoboda 94e64df576 [clang][modules] Consider M affecting after mapping M.Private to M_Private
When Clang encounters `@import M.Private` during implicit build, it precompiles module `M` and looks through its submodules. If the `Private` submodule is not found, Clang assumes `@import M_Private`. In the dependency scanner, we don't capture the dependency on `M`, since it's not imported. It's an affecting module, though: compilation of the import statement will fail when implicit modules are disabled and `M` is not precompiled and explicitly provided. This patch fixes that.

Depends on D132430.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D132502
2022-08-24 14:36:06 -07:00

25 lines
1.2 KiB
Objective-C

// RUN: rm -rf %t
// Implicit modules.
// RUN: %clang_cc1 -verify -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
// RUN: -F %S/Inputs/implicit-private-canonical -fsyntax-only %s -Wprivate-module
// Explicit modules.
// RUN: %clang_cc1 -x objective-c -fmodules -emit-module -fmodule-name=A -o %t/A.pcm \
// RUN: %S/Inputs/implicit-private-canonical/A.framework/Modules/module.modulemap -Wprivate-module
// RUN: %clang_cc1 -x objective-c -fmodules -emit-module -fmodule-name=A_Private -o %t/A_Private.pcm \
// RUN: %S/Inputs/implicit-private-canonical/A.framework/Modules/module.private.modulemap -Wprivate-module
// RUN: %clang_cc1 -verify -fmodules -fimplicit-module-maps -fno-implicit-modules \
// RUN: -fmodule-file=A=%t/A.pcm -fmodule-file=A_Private=%t/A_Private.pcm \
// RUN: -F %S/Inputs/implicit-private-canonical -fsyntax-only %s -Wprivate-module
#ifndef HEADER
#define HEADER
@import A.Private; // expected-warning {{no submodule named 'Private' in module 'A'; using top level 'A_Private'}}
// expected-note@Inputs/implicit-private-canonical/A.framework/Modules/module.private.modulemap:1{{module defined here}}
const int *y = &APRIVATE;
#endif