Debian Codegraph @

clang/test/ClangScanDeps/modules-debug-dir.c

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json
4 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format \
5 // RUN: experimental-full -optimize-args=all > %t/result.json
6 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s
7
8 // RUN: %deps-to-rsp %t/result.json --module-name=mod > %t/mod.rsp
9 // RUN: %clang @%t/mod.rsp -o %t/mod.pcm
10 // RUN: llvm-dwarfdump --debug-info %t/mod.pcm | FileCheck %s --check-prefix=DWARF
11 // DWARF: DW_TAG_compile_unit
12 // DWARF-NOT: DW_AT_comp_dir
13
14 //--- cdb.json.in
15 [{
16 "directory": "DIR",
17 "command": "clang -c -g -gmodules DIR/tu.c -fmodules -fmodules-cache-path=DIR/cache -IDIR/include/ -fdebug-compilation-dir=DIR -o DIR/tu.o",
18 "file": "DIR/tu.c"
19 }]
20
21 //--- include/module.modulemap
22 module mod {
23 header "mod.h"
24 }
25
26 //--- include/mod.h
27
28 //--- tu.c
29 #include "mod.h"
30
31 // Check the -fdebug-compilation-dir used for the module is the root
32 // directory when current working directory optimization is in effect.
33 // CHECK: "modules": [
34 // CHECK: "command-line": [
35 // CHECK-NOT: -fdebug-compilation-dir
36 // CHECK: "translation-units": [