xref: /llvm-project/clang/test/ClangScanDeps/modules-cc1.cpp (revision 6b4de7b1c71b6b701e130c2a533d285dc93b8370)
1 // Check that clang-scan-deps works with cc1 command lines
2 
3 // RUN: rm -rf %t
4 // RUN: split-file %s %t
5 
6 
7 //--- modules_cc1.cpp
8 #include "header.h"
9 
10 //--- header.h
11 
12 //--- module.modulemap
13 module header1 { header "header.h" }
14 
15 //--- cdb.json.template
16 [{
17   "file": "DIR/modules_cc1.cpp",
18   "directory": "DIR",
19   "command": "clang -cc1 DIR/modules_cc1.cpp -fimplicit-module-maps -o modules_cc1.o"
20 }]
21 
22 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
23 // RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 -mode preprocess-dependency-directives > %t/result
24 // RUN: cat %t/result | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
25 
26 // CHECK: modules_cc1.o:
27 // CHECK-NEXT: [[PREFIX]]/modules_cc1.cpp
28 // CHECK-NEXT: [[PREFIX]]/module.modulemap
29 // CHECK-NEXT: [[PREFIX]]/header.h
30