[PATCH] D134733: [clang-format][chore] transparent #include name regex

Konrad Wilhelm Kleine via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 27 05:49:35 PDT 2022


kwk created this revision.
kwk added a reviewer: MyDeveloperDay.
Herald added a project: All.
kwk requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The foundation for this patch was done in:
https://reviews.llvm.org/D121370. I wanted to "rescue" some pieces from
it.

Unlike D121370 <https://reviews.llvm.org/D121370>, this patch doesn't modify the regular expression itself.
It simply provides three functions to have a cleaner and more
transparent way how the include name is processed from an `#include`
line.

Here's how I've tested this patch:

  $ cd llvm-project
  $ mkdir build && cd build
  $ cmake ../llvm/ -DCMAKE_BUILD_TYPE=Release -DCLANG_BUILD_TOOLS=On -DLLVM_ENABLE_PROJECTS=clang -DCLANG_INCLUDE_TESTS=ON -DLLVM_BUILD_UTILS=ON -G Ninja
  $ ninja clangFormat
  $ ninja FormatTests
  $ ./tools/clang/unittests/Format/FormatTests --gtest_filter=SortIncludesTest*

And if that worked I doubled checked that nothing else broke by running
all format checks:

  $ ./tools/clang/unittests/Format/FormatTests


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134733

Files:
  clang/include/clang/Tooling/Inclusions/HeaderIncludes.h
  clang/lib/Format/Format.cpp
  clang/lib/Tooling/Inclusions/HeaderIncludes.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134733.463205.patch
Type: text/x-patch
Size: 6915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220927/c68361ca/attachment.bin>


More information about the cfe-commits mailing list