[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / tag-injection.cpp
blobdca520e921a109459a47b8c9b92d2e57de03ff5e
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: echo 'struct tm;' > %t/a.h
4 // RUN: echo 'struct X {}; void foo(struct tm*);' > %t/b.h
5 // RUN: echo 'module X { module a { header "a.h" } module b { header "b.h" } }' > %t/x.modulemap
6 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -fmodule-map-file=%t/x.modulemap %s -I%t -verify -std=c++11
7 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -fmodule-map-file=%t/x.modulemap %s -I%t -verify -fmodules-local-submodule-visibility -std=c++11
9 #include "a.h"
11 using ::tm;
13 struct A {
14 // This use of 'struct X' makes the declaration (but not definition) of X visible.
15 virtual void f(struct X *p);
18 namespace N {
19 struct B : A {
20 void f(struct X *q) override;
24 X x; // expected-error {{'X' must be defined before it is used}}
25 // expected-note@b.h:1 {{here}}