[all-commits] [llvm/llvm-project] 11c11e: [clang][Lex] Preserve MultipleIncludeOpt state in ...

Benjamin Luke via All-commits all-commits at lists.llvm.org
Wed Mar 4 06:11:57 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 11c11ec2e9fd825f625fd7fcb8318e72fe1b9e4a
      https://github.com/llvm/llvm-project/commit/11c11ec2e9fd825f625fd7fcb8318e72fe1b9e4a
  Author: Benjamin Luke <benjamin.luke at sony.com>
  Date:   2026-03-04 (Wed, 04 Mar 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Lex/Lexer.cpp
    A clang/test/Preprocessor/miopt-peek-restore-header-guard.cpp
    M clang/unittests/Lex/LexerTest.cpp

  Log Message:
  -----------
  [clang][Lex] Preserve MultipleIncludeOpt state in Lexer::peekNextPPToken (#183425)

Fixes https://github.com/llvm/llvm-project/issues/180155.

This is a duplicate of https://github.com/llvm/llvm-project/pull/180700
except that I also added some tests, fine to go with either PR, but we
should add the tests.

peekNextPPToken lexed a token and mutated MIOpt, which could clear the
controlling-macro state for main files in C++20 modules mode.
Save/restore MIOpt in Lexer::peekNextPPToken.

Add regression coverage in
LexerTest.MainFileHeaderGuardedWithCPlusPlusModules that checks to make
sure the controlling macro is properly set in C++20 mode.

Add source level lit test in miopt-peek-restore-header-guard.cpp that
checks to make sure that the warnings that depend on the MIOpt state
machine are emitted in C++20 mode.



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