llvm-capstone/clang/test/Modules/implementation-of-module-private.m
Jan Svoboda c3efd52770 [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
2023-01-20 13:37:36 -08:00

14 lines
484 B
Mathematica

// RUN: rm -rf %t
// RUN: split-file %s %t
//--- frameworks/FW.framework/Modules/module.modulemap
framework module FW {}
//--- frameworks/FW.framework/Modules/module.private.modulemap
framework module FW_Private {}
//--- tu.m
@import FW_Private; // expected-error{{@import of module 'FW_Private' in implementation of 'FW'; use #import}}
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -fimplicit-module-maps \
// RUN: -fmodule-name=FW -F %t/frameworks %t/tu.m -verify