[clang][deps] Respect Lexer::cutOffLexing() (#134404) · llvm/llvm-project@cde90e6 (original) (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 -- \
`
``
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: 2>&1 | FileCheck %s
`
``
21
+
``
22
`+
// CHECK: fatal error: module 'A' is defined in both '{{.}}.pcm' and '{{.}}.pcm'
`
``
23
+
``
24
`+
//--- frameworks2/A.framework/Modules/module.modulemap
`
``
25
`+
framework module A { header "A.h" }
`
``
26
`+
//--- frameworks2/A.framework/Headers/A.h
`
``
27
`+
#define MACRO_A 1
`
``
28
+
``
29
`+
//--- frameworks2/B.framework/Modules/module.modulemap
`
``
30
`+
framework module B { header "B.h" }
`
``
31
`+
//--- frameworks2/B.framework/Headers/B.h
`
``
32
`+
#include <A/A.h>
`
``
33
+
``
34
`+
//--- tu1.m
`
``
35
`+
#include <B/B.h>
`
``
36
+
``
37
`+
//--- tu2.m
`
``
38
`+
#include <A/A.h>
`
``
39
`+
#include <B/B.h> // This results in a conflict and a fatal loader error.
`
``
40
+
``
41
`` +
#if MACRO_A // This crashes with lexer that does not respect cutOfLexing().
``
``
42
`+
#endif
`