
Such searches can be costly and non-intuitive. We've seen complaints from developers that they don't expect clang to find modules on their own and not in search paths that developers provide. Keeping the search of modulemaps in subdirectories for code completion as it provides better user experience. If you are defining module "UsefulCode" in "include/UnrelatedName/module.modulemap", it is recommended to rename the directory "UnrelatedName" to "UsefulCode". If you cannot do so, you can add to "include/module.modulemap" a line like `extern module UsefulCode "UnrelatedName/module.modulemap"`, so clang can find module "UsefulCode" without checking each subdirectory in "include/". rdar://106677321 --------- Co-authored-by: Jan Svoboda <jan@svoboda.ai>
19 lines
691 B
Objective-C
19 lines
691 B
Objective-C
// RUN: rm -rf %t
|
|
// RUN: split-file %s %t
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache -I %t/include %t/test.m
|
|
// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache -I %t/include %t/test.m -fmodulemap-allow-subdirectory-search
|
|
// RUN: not %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache -I %t/include %t/test.m -fno-modulemap-allow-subdirectory-search
|
|
|
|
//--- include/UnrelatedName/Header.h
|
|
// empty
|
|
|
|
//--- include/UnrelatedName/module.modulemap
|
|
module UsefulCode {
|
|
header "Header.h"
|
|
export *
|
|
}
|
|
|
|
//--- test.m
|
|
@import UsefulCode;
|