Debian Codegraph @

clang/test/ClangScanDeps/modules-relocated-mm-macro.c

raw
1 // This test checks that we don't crash when we load two conflicting PCM files
2 // and instead emit the appropriate diagnostics.
3
4 // RUN: rm -rf %t
5 // RUN: split-file %s %t
6
7 // RUN: mkdir %t/frameworks1
8
9 // RUN: clang-scan-deps -format experimental-full -o %t/deps1.json -- \
10 // RUN: %clang -fmodules -fmodules-cache-path=%t/cache \
11 // RUN: -F %t/frameworks1 -F %t/frameworks2 \
12 // RUN: -c %t/tu1.m -o %t/tu1.o
13
14 // RUN: cp -r %t/frameworks2/A.framework %t/frameworks1
15
16 // RUN: not clang-scan-deps -format experimental-full -o %t/deps2.json 2>%t/errs -- \
17 // RUN: %clang -fmodules -fmodules-cache-path=%t/cache \
18 // RUN: -F %t/frameworks1 -F %t/frameworks2 \
19 // RUN: -c %t/tu2.m -o %t/tu2.o
20 // RUN: FileCheck --input-file=%t/errs %s
21
22 // CHECK: fatal error: module 'A' is defined in both '{{.*}}.pcm' and '{{.*}}.pcm'
23 // CHECK-NEXT: note: compiled from '{{.*}}frameworks1{{.*}}' and '{{.*}}frameworks2{{.*}}'
24
25 //--- frameworks2/A.framework/Modules/module.modulemap
26 framework module A { header "A.h" }
27 //--- frameworks2/A.framework/Headers/A.h
28 #define MACRO_A 1
29
30 //--- frameworks2/B.framework/Modules/module.modulemap
31 framework module B { header "B.h" }
32 //--- frameworks2/B.framework/Headers/B.h
33 #include <A/A.h>
34
35 //--- tu1.m
36 #include <B/B.h>
37
38 //--- tu2.m
39 #include <A/A.h>
40 #include <B/B.h> // This results in a conflict and a fatal loader error.
41
42 #if MACRO_A // This crashes with lexer that does not respect `cutOfLexing()`.
43 #endif