[PATCH] D121370: [clang-format] SortIncludes should support "@import" lines in Objective-C

Konrad Wilhelm Kleine via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 07:26:45 PDT 2022


kwk updated this revision to Diff 426701.
kwk added a comment.

Address trailing comments on include lines by ignoring slashes in
characters that lead up to the match groups.

  ^[\t\ ]*[@#][\t\ ]*(import|include)([^"/]*("[^"]+")|[^</]*(<[^>]+>)|[\t/\ ]*([^;]+;))
          ~~~~                        ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
          ^                                 ^           ^       ^       ^
          |                                 |           |       |       |
          Now support @ and #.            Clearly support "" and <> as ell as an
                                          include name without enclosing characters.
                                          Allows for no mixture of "> or <" or
                                          empty include names. Trailing
                                          comments on include lines as shown in
                                          D124513 are ignored now by
                                          ignoring slashes in the characters that
                                          lead up to a match group.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121370/new/

https://reviews.llvm.org/D121370

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121370.426701.patch
Type: text/x-patch
Size: 11964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220503/f0b05376/attachment-0001.bin>


More information about the cfe-commits mailing list