File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -4545,6 +4545,9 @@ bool Lexer::LexDependencyDirectiveToken(Token &Result) {
45454545
45464546 using namespace dependency_directives_scan ;
45474547
4548+ if (BufferPtr == BufferEnd)
4549+ return LexEndOfFile (Result, BufferPtr);
4550+
45484551 while (NextDepDirectiveTokenIndex == DepDirectives.front ().Tokens .size ()) {
45494552 if (DepDirectives.front ().Kind == pp_eof)
45504553 return LexEndOfFile (Result, BufferEnd);
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments