57 lines · c
1// Check that Wsystem-headers-in-module shows diagnostics in the named system2// module, but not in other system headers or modules when built with explicit3// modules.4 5// RUN: rm -rf %t6// RUN: split-file %s %t7// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json8 9// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/deps.json10 11// RUN: %deps-to-rsp %t/deps.json --module-name=dependent_sys_mod > %t/dependent_sys_mod.rsp12// RUN: %deps-to-rsp %t/deps.json --module-name=sys_mod > %t/sys_mod.rsp13// RUN: %deps-to-rsp %t/deps.json --module-name=other_sys_mod > %t/other_sys_mod.rsp14// RUN: %deps-to-rsp %t/deps.json --tu-index 0 > %t/tu.rsp15 16// RUN: %clang @%t/dependent_sys_mod.rsp -verify17// RUN: %clang @%t/sys_mod.rsp -verify18// RUN: %clang @%t/other_sys_mod.rsp -verify19// RUN: %clang @%t/tu.rsp -verify20 21// CHECK-NOT: warning:22// CHECK: sys_mod.h:2:7: warning: extra ';'23// CHECK-NOT: warning:24 25//--- cdb.json.template26[{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"30}]31 32//--- sys/other_sys_header.h33int x;;34 35//--- sys_mod.h36#include "dependent_sys_mod.h"37int y;; // expected-warning {{extra ';' outside of a function}}38 39//--- other_sys_mod.h40int z;;41// expected-no-diagnostics42 43//--- dependent_sys_mod.h44int w;;45// expected-no-diagnostics46 47//--- module.modulemap48module sys_mod [system] { header "sys_mod.h" }49module other_sys_mod [system] { header "other_sys_mod.h" }50module dependent_sys_mod [system] { header "dependent_sys_mod.h" }51 52//--- tu.c53#include "sys_mod.h"54#include "other_sys_mod.h"55#include "other_sys_header.h"56// expected-no-diagnostics57