[clang] [clang-tools-extra] [clangd] fix preprocessor caching-lexer state tracking (PR #203716)

Yihan Wang via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 06:47:34 PDT 2026


================
@@ -106,6 +106,9 @@ bool Preprocessor::EnterSourceFile(FileID FID, ConstSearchDirIterator CurDir,
 ///  and start lexing tokens from it instead of the current buffer.
 void Preprocessor::EnterSourceFileWithLexer(std::unique_ptr<Lexer> TheLexer,
                                             ConstSearchDirIterator CurDir) {
+  if (InCachingLexMode())
+    ExitCachingLexMode();
----------------
yronglin wrote:

Yes, it's unecessary, we don't need ExitCachingLexMode here.

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


More information about the cfe-commits mailing list