[all-commits] [llvm/llvm-project] c9592a: [clang-format] Fix preprocessor nesting after comm...

Krasimir Georgiev via All-commits all-commits at lists.llvm.org
Tue Feb 22 06:44:22 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c9592ae49b8c486754a745e0c7b1a30b92a12e8b
      https://github.com/llvm/llvm-project/commit/c9592ae49b8c486754a745e0c7b1a30b92a12e8b
  Author: Krasimir Georgiev <krasimir at google.com>
  Date:   2022-02-22 (Tue, 22 Feb 2022)

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

  Log Message:
  -----------
  [clang-format] Fix preprocessor nesting after commit 529aa4b011c4ae808d658022ef643c44dd9b2c9c

In https://github.com/llvm/llvm-project/commit/529aa4b011c4ae808d658022ef643c44dd9b2c9c
by setting the identifier info to nullptr, we started to subtly
interfere with the parts in the beginning of the function,
https://github.com/llvm/llvm-project/blob/529aa4b011c4ae808d658022ef643c44dd9b2c9c/clang/lib/Format/UnwrappedLineParser.cpp#L991
causing the preprocessor nesting to change in some cases. E.g., for the
added regression test, clang-format started incorrectly guessing the
language as C++.

This tries to address this by introducing an internal identifier info
element to use instead.

Reviewed By: curdeius, MyDeveloperDay

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




More information about the All-commits mailing list