1 // Check that Wsystem-headers-in-module shows diagnostics in the named system
2 // module, but not in other system headers or modules when built with explicit
6 // RUN: split-file %s %t
7 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
9 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/deps.json
11 // RUN: %deps-to-rsp %t/deps.json --module-name=dependent_sys_mod > %t/dependent_sys_mod.rsp
12 // RUN: %deps-to-rsp %t/deps.json --module-name=sys_mod > %t/sys_mod.rsp
13 // RUN: %deps-to-rsp %t/deps.json --module-name=other_sys_mod > %t/other_sys_mod.rsp
14 // RUN: %deps-to-rsp %t/deps.json --tu-index 0 > %t/tu.rsp
16 // RUN: %clang @%t/dependent_sys_mod.rsp -verify
17 // RUN: %clang @%t/sys_mod.rsp -verify
18 // RUN: %clang @%t/other_sys_mod.rsp -verify
19 // RUN: %clang @%t/tu.rsp -verify
21 // CHECK-NOT: warning:
22 // CHECK: sys_mod.h:2:7: warning: extra ';'
23 // CHECK-NOT: warning:
25 //--- cdb.json.template
28 "command": "clang -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/mcp DIR/tu.c -isystem DIR/sys -Wextra-semi -Wsystem-headers-in-module=sys_mod",
32 //--- sys/other_sys_header.h
36 #include "dependent_sys_mod.h"
37 int y
;; // expected-warning {{extra ';' outside of a function}}
41 // expected-no-diagnostics
43 //--- dependent_sys_mod.h
45 // expected-no-diagnostics
47 //--- module.modulemap
48 module sys_mod
[system
] { header
"sys_mod.h" }
49 module other_sys_mod
[system
] { header
"other_sys_mod.h" }
50 module dependent_sys_mod
[system
] { header
"dependent_sys_mod.h" }
54 #include "other_sys_mod.h"
55 #include "other_sys_header.h"
56 // expected-no-diagnostics