brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · a35695d Raw
48 lines · cpp
1// RUN: rm -rf %t2// RUN: not %clang_cc1 -x c++ -Rmodule-build -DMISSING_HEADER -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/auto-import-unavailable %s 2>&1 | FileCheck %s --check-prefix=MISSING-HEADER3// RUN: %clang_cc1 -x c++ -Rmodule-build -DNONREQUIRED_MISSING_HEADER -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/auto-import-unavailable %s 2>&1 | FileCheck %s --check-prefix=NONREQUIRED-MISSING-HEADER4// RUN: not %clang_cc1 -x c++ -Rmodule-build -DMISSING_REQUIREMENT -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/auto-import-unavailable %s 2>&1 | FileCheck %s --check-prefix=MISSING-REQUIREMENT5 6#ifdef MISSING_HEADER7 8// Even if the header we ask for is not missing, if the top-level module9// containing it has a missing header, then the whole top-level is10// unavailable and we issue an error.11 12// MISSING-HEADER: module.modulemap:2:27: error: header 'missing_header/missing.h' not found13// MISSING-HEADER-DAG: auto-import-unavailable.cpp:[[@LINE+1]]:10: note: submodule of top-level module 'missing_header' implicitly imported here14#include "missing_header/not_missing.h"15 16// We should not attempt to build the module.17// MISSING-HEADER-NOT: remark: building module18 19#endif // #ifdef MISSING_HEADER20 21 22#ifdef NONREQUIRED_MISSING_HEADER23 24// However, if the missing header is dominated by an unsatisfied25// `requires`, then that is acceptable.26// This also tests that an unsatisfied `requires` elsewhere in the27// top-level module doesn't affect an available module.28 29// NONREQUIRED-MISSING-HEADER: auto-import-unavailable.cpp:[[@LINE+2]]:10: remark: building module 'nonrequired_missing_header'30// NONREQUIRED-MISSING-HEADER: auto-import-unavailable.cpp:[[@LINE+1]]:10: remark: finished building module 'nonrequired_missing_header'31#include "nonrequired_missing_header/not_missing.h"32 33#endif // #ifdef NONREQUIRED_MISSING_HEADER34 35 36#ifdef MISSING_REQUIREMENT37 38// If the header is unavailable due to a missing requirement, an error39// should be emitted if a user tries to include it.40 41// MISSING-REQUIREMENT:module.modulemap:16:8: error: module 'missing_requirement' requires feature 'nonexistent_feature'42// MISSING-REQUIREMENT: auto-import-unavailable.cpp:[[@LINE+1]]:10: note: submodule of top-level module 'missing_requirement' implicitly imported here43#include "missing_requirement.h"44 45// MISSING-REQUIREMENT-NOT: remark: building module46 47#endif // #ifdef MISSING_REQUIREMENT48