[clang] [clang][deps] Stop lexing if hit a failure while loading a PCH/module in a submodule. (PR #146976)

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 3 17:10:23 PDT 2025


================
@@ -4589,6 +4589,9 @@ bool Lexer::LexDependencyDirectiveToken(Token &Result) {
 
   if (Result.is(tok::hash) && Result.isAtStartOfLine()) {
     PP->HandleDirective(Result);
+    if (PP->hadModuleLoaderFatalFailure())
+      // With a fatal failure in the module loader, we abort parsing.
+      return true;
----------------
vsapsai wrote:

Here `true` means "stop lexing" and it is interpreted in the loop
```c++
  while (!CurLexerCallback(*this, Result))
    ;
```

in `Preprocessor::Lex`.

https://github.com/llvm/llvm-project/pull/146976


More information about the cfe-commits mailing list