[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / textual-headers.cpp
blob006ae9686f345545cd3db0f31bc9c834c972e474
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-strict-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify
3 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-strict-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify -fno-modules-error-recovery
5 #define GIMME_A_K
6 #include "k.h"
8 #define GIMME_AN_L
9 #include "l.h" // expected-error {{module XG does not directly depend on a module exporting 'l.h', which is part of indirectly-used module XL}}
11 #include "m2.h" // expected-error {{module XG does not directly depend on a module exporting 'm2.h', which is part of indirectly-used module XM}}
12 const int use_m = m; // expected-error {{undeclared identifier}}
14 #define GIMME_AN_M
15 #include "m.h" // expected-error {{use of private header from outside its module: 'm.h'}}
16 const int use_m_2 = m;
18 const int g = k + l;