[all-commits] [llvm/llvm-project] 0529a3: [clang][Preprocessor] Handle the first pp-token in...

yronglin via All-commits all-commits at lists.llvm.org
Wed Jun 25 17:50:04 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0529a346007cecab95c6820a60cb3e4e36f34990
      https://github.com/llvm/llvm-project/commit/0529a346007cecab95c6820a60cb3e4e36f34990
  Author: yronglin <yronglin777 at gmail.com>
  Date:   2025-06-26 (Thu, 26 Jun 2025)

  Changed paths:
    M clang/include/clang/Lex/Preprocessor.h
    M clang/include/clang/Lex/TokenLexer.h
    M clang/lib/Lex/Lexer.cpp
    M clang/lib/Lex/PPDirectives.cpp
    M clang/lib/Lex/PPMacroExpansion.cpp
    M clang/lib/Lex/Preprocessor.cpp
    M clang/lib/Sema/SemaModule.cpp
    M clang/unittests/Lex/LexerTest.cpp

  Log Message:
  -----------
  [clang][Preprocessor] Handle the first pp-token in EnterMainSourceFile (#145244)

Depends on [[clang][Preprocessor] Add peekNextPPToken, makes look ahead
next token without
side-effects](https://github.com/llvm/llvm-project/pull/143898).

This PR fix the performance regression that introduced in
https://github.com/llvm/llvm-project/pull/144233.
The original PR(https://github.com/llvm/llvm-project/pull/144233) handle
the first pp-token in the main source file in the macro
definition/expansion and `Lexer::Lex`, but the lexer is almost always on
the hot path, we may hit a performance regression. In this PR, we handle
the first pp-token in `Preprocessor::EnterMainSourceFile`.

---------

Signed-off-by: yronglin <yronglin777 at gmail.com>



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