Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / ClangScanDeps / Wsystem-headers-in-module.c
blob98bdc4a8e13a84b7f649a52a2f0b4841e45219a6
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
3 // modules.
5 // RUN: rm -rf %t
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
27 "directory": "DIR",
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",
29 "file": "DIR/tu.c"
32 //--- sys/other_sys_header.h
33 int x;;
35 //--- sys_mod.h
36 #include "dependent_sys_mod.h"
37 int y;; // expected-warning {{extra ';' outside of a function}}
39 //--- other_sys_mod.h
40 int z;;
41 // expected-no-diagnostics
43 //--- dependent_sys_mod.h
44 int w;;
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" }
52 //--- tu.c
53 #include "sys_mod.h"
54 #include "other_sys_mod.h"
55 #include "other_sys_header.h"
56 // expected-no-diagnostics