xref: /llvm-project/clang/test/ClangScanDeps/modules-minimize-module.c (revision 2248164a9ab791a3ed1b9586dc340b5303155021)
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 
4 // This test checks that source files of modules undergo dependency directives
5 // scan. If a.h would not, the scan would fail when lexing `#error`.
6 
7 //--- module.modulemap
8 module A { header "a.h" }
9 
10 //--- a.h
11 #error blah
12 
13 //--- tu.c
14 #include "a.h"
15 
16 //--- cdb.json.in
17 [{
18   "directory": "DIR",
19   "file": "DIR/tu.c",
20   "command": "clang -c DIR/tu.c -fmodules -fmodules-cache-path=DIR/cache"
21 }]
22 
23 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json
24 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/deps.json
25