llvm-project
11c11ec2 - [clang][Lex] Preserve MultipleIncludeOpt state in Lexer::peekNextPPToken (#183425)

Commit
13 days ago
[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.
Parents
Loading