[all-commits] [llvm/llvm-project] 0a3c82: [clang-format][NFC] Store FormatToken::Type as an ...

Alexander Richardson via All-commits all-commits at lists.llvm.org
Wed Oct 7 09:18:32 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0a3c82e85b73e51e830b57844b2f5b98cb59afd1
      https://github.com/llvm/llvm-project/commit/0a3c82e85b73e51e830b57844b2f5b98cb59afd1
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2020-10-07 (Wed, 07 Oct 2020)

  Changed paths:
    M clang/lib/Format/FormatToken.h
    M clang/lib/Format/UnwrappedLineParser.cpp

  Log Message:
  -----------
  [clang-format][NFC] Store FormatToken::Type as an enum instead of bitfield

This improves the debugging experience since LLDB will print the enumerator
name instead of a decimal number. This changes TokenType to have uint8_t
as the underlying type and moves it after the remaining bitfields to avoid
increasing the size of FormatToken.

Reviewed By: MyDeveloperDay

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


  Commit: ff6e4441b93953efb2c52995e79e211a49ffac06
      https://github.com/llvm/llvm-project/commit/ff6e4441b93953efb2c52995e79e211a49ffac06
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2020-10-07 (Wed, 07 Oct 2020)

  Changed paths:
    M clang/unittests/Format/MacroExpanderTest.cpp
    M clang/unittests/Format/TestLexer.h

  Log Message:
  -----------
  [clang-format][tests] Fix MacroExpander lexer not parsing C++ keywords

While debugging a different clang-format failure, I tried to reuse the
MacroExpander lexer, but was surprised to see that it marks all C++
keywords (e.g. const, decltype) as being of type identifier. After stepping
through the ::format() code, I noticed that the difference between these
two is that the identifier table was not being initialized based on the
FormatStyle, so only basic tokens such as tok::semi, tok::plus, etc. were
being handled.

Reviewed By: klimek

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


Compare: https://github.com/llvm/llvm-project/compare/7a01fc5abe4c...ff6e4441b939


More information about the All-commits mailing list