[all-commits] [llvm/llvm-project] fb65b1: [NFCI] Refactor how KeywordStatus is calculated

Erich Keane via All-commits all-commits at lists.llvm.org
Wed Aug 3 06:41:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fb65b17932e1163adeda943a3a36f9b482b97f47
      https://github.com/llvm/llvm-project/commit/fb65b17932e1163adeda943a3a36f9b482b97f47
  Author: Erich Keane <erich.keane at intel.com>
  Date:   2022-08-03 (Wed, 03 Aug 2022)

  Changed paths:
    M clang/include/clang/Basic/TokenKinds.def
    M clang/lib/Basic/IdentifierTable.cpp
    M clang/test/Lexer/keywords_test.cpp

  Log Message:
  -----------
  [NFCI] Refactor how KeywordStatus is calculated

The getKeywordStatus function is a horrible mess of inter-dependent 'if'
statements that depend significantly on the ORDER of the checks.  This
patch removes the dependency on order by checking each set-flag only
once.

It does this by looping through each of the set bits, and checks each
individual flag for its effect, then combines them at the end.

This might slow down startup performance slightly, as there are only a
few hundred keywords, and a vast majority will only get checked 1x
still.

This patch ALSO removes the KEYWORD_CONCEPTS flag, because it has since
become synonymous with C++20.

Differential Revision: https://reviews.llvm.org/D131007




More information about the All-commits mailing list