[all-commits] [llvm/llvm-project] 3b05ed: [clang][deps] Stop lexing if hit a failure while l...

Volodymyr Sapsai via All-commits all-commits at lists.llvm.org
Mon Jul 7 12:28:25 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b05edfc5f3c506dc8820d157fd87c7e984840f6
      https://github.com/llvm/llvm-project/commit/3b05edfc5f3c506dc8820d157fd87c7e984840f6
  Author: Volodymyr Sapsai <vsapsai at apple.com>
  Date:   2025-07-07 (Mon, 07 Jul 2025)

  Changed paths:
    M clang/lib/Lex/Lexer.cpp
    A clang/test/ClangScanDeps/fatal-module-loader-error.m

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

Otherwise we are continuing in an invalid state and can easily crash.

It is a follow-up to cde90e68f8123e7abef3f9e18d79980aa19f460a but an
important difference is when a failure happens in a submodule. In this
case in `Preprocessor::HandleEndOfFile` `tok::eof` is replaced by
`tok::annot_module_end`. And after exiting a file with bad
`#include/#import` we work with a new buffer, so `BufferPtr < BufferEnd`.
As there are no signs to stop lexing we just keep doing it.

The fix is the same as in dc9fdaf2171cc480300d5572606a8ede1678d18b in
`Lexer::LexTokenInternal` but this time in
`Lexer::LexDependencyDirectiveToken` as well.

rdar://152499276



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list