Clang Project

clang_source_code/test/Modules/tag-injection.c
1// RUN: rm -rf %t
2// RUN: mkdir %t
3// RUN: echo 'struct a;' > %t/a.h
4// RUN: echo 'struct b {}; void foo(struct b*);' > %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 -fmodule-map-file=%t/x.modulemap %s -I%t -verify
7
8#include "a.h"
9
10void f(struct a *p);
11
12// FIXME: We should warn that 'b' will not be visible outside of this function,
13// but we merge this 'b' with X.b's 'b' because we don't yet implement C's
14// "compatible types" rule.
15void g(struct b *p);
16
17struct b b; // expected-error {{definition of 'b' must be imported from module 'X.b' before it is required}}
18// expected-note@b.h:1 {{here}}
19