Skip to content

Commit 2f1a5ce

Browse files
author
git apple-llvm automerger
committed
Merge commit '56828f4273f9' from swift/release/6.2 into stable/20240723
2 parents 02bac1d + 56828f4 commit 2f1a5ce

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

clang/lib/Lex/Lexer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4584,6 +4584,9 @@ bool Lexer::LexDependencyDirectiveToken(Token &Result) {
45844584

45854585
if (Result.is(tok::hash) && Result.isAtStartOfLine()) {
45864586
PP->HandleDirective(Result);
4587+
if (PP->hadModuleLoaderFatalFailure())
4588+
// With a fatal failure in the module loader, we abort parsing.
4589+
return true;
45874590
return false;
45884591
}
45894592
if (Result.is(tok::raw_identifier)) {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// This tests that after a fatal module loader error, we do not continue parsing.
2+
3+
// RUN: rm -rf %t
4+
// RUN: split-file %s %t
5+
// RUN: mkdir %t/ModulesCache
6+
// RUN: touch %t/ModulesCache/Unusable.pcm
7+
8+
// RUN: not clang-scan-deps -format experimental-full -mode preprocess-dependency-directives -- \
9+
// RUN: %clang -fmodules -fimplicit-modules -Xclang -fdisable-module-hash -fmodules-cache-path=%t/ModulesCache \
10+
// RUN: -F %t/Frameworks -c %t/test.m -o %t/test.o
11+
// RUN: ls %t/ModulesCache | not grep AfterUnusable
12+
13+
//--- Frameworks/Unusable.framework/Headers/Unusable.h
14+
// empty
15+
//--- Frameworks/Unusable.framework/Modules/module.modulemap
16+
framework module Unusable { header "Unusable.h" }
17+
18+
//--- Frameworks/AfterUnusable.framework/Headers/AfterUnusable.h
19+
// empty
20+
//--- Frameworks/AfterUnusable.framework/Modules/module.modulemap
21+
framework module AfterUnusable { header "AfterUnusable.h" }
22+
23+
//--- Frameworks/Importer.framework/Headers/Importer.h
24+
#import <Importer/ImportUnusable.h>
25+
// Parsing should have stopped and we should not handle AfterUnusable.
26+
#import <AfterUnusable/AfterUnusable.h>
27+
28+
//--- Frameworks/Importer.framework/Headers/ImportUnusable.h
29+
// It is important that this header is a submodule.
30+
#import <Unusable/Unusable.h>
31+
// Parsing should have stopped and we should not handle AfterUnusable.
32+
#import <AfterUnusable/AfterUnusable.h>
33+
34+
//--- Frameworks/Importer.framework/Modules/module.modulemap
35+
framework module Importer {
36+
umbrella header "Importer.h"
37+
module * { export * }
38+
export *
39+
}
40+
41+
//--- test.m
42+
#import <Importer/Importer.h>

0 commit comments

Comments
 (0)