[all-commits] [llvm/llvm-project] a11292: [clang-format] Don't skip stringizing when determi...

Emilia Kond via All-commits all-commits at lists.llvm.org
Thu Nov 30 11:26:53 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a112921d88c28b9d3ac30cad7dbc961a33f22926
      https://github.com/llvm/llvm-project/commit/a112921d88c28b9d3ac30cad7dbc961a33f22926
  Author: Emilia Kond <emilia at rymiel.space>
  Date:   2023-11-30 (Thu, 30 Nov 2023)

  Changed paths:
    M clang/lib/Format/UnwrappedLineParser.cpp
    M clang/unittests/Format/TokenAnnotatorTest.cpp

  Log Message:
  -----------
  [clang-format] Don't skip stringizing when determining brace kind (#73886)

PR #69473 introduced skipping PP directives when determining the brace
kind of an lbrace. However, it did so by skipping to the end of the line
when encountering a hash character. This means it also skipped to the
end of line when encountering a macro stringizing operator, which,
unlike PP directives, don't have effect until the end of line.

This led to cases where the rbrace could be completely skipped if it was
on the same line as a stringizing operator.

This patch skips hash characters if we're already in a PP directive, as
you can't define a macro inside of a macro

Fixes https://github.com/llvm/llvm-project/issues/72662




More information about the All-commits mailing list