[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:32:17 PDT 2022
kwk added a comment.
@krasimir could you please test this patch on your side? I've reopened it and tested it with the following file that contains both `//` and `/* ... */` trailing comments on include lines followed by `foo<T>` and alike. The includes use `<...>` and `"..."` notation to locate files.
*test.h*
#include <cstdint>
#include "util/bar.h"
#include "util/foo/foo.h" // foo<T>
#include "util/bar/bar.h" // bar
#include "utilzbar0.h" // bar0<T>
#include <util/foo/foo3.h> // foo3<T>
#include <util/bar/bar3.h> // bar3
#include <util/foo/foo2.h> // foo2<T>
#include <util/bar/bar2.h> // bar2
#include "util/bar.h"
#include "util/foo/foo.h" /* foo<T> */
#include "util/bar/bar.h" /* bar */
#include "utilzbar0.h" /* bar0<T> */
#include <util/foo/foo3.h> /* foo3<T> */
#include <util/bar/bar3.h> /* bar3 */
#include <util/foo/foo2.h> /* foo2<T> */
#include <util/bar/bar2.h> /* bar2 */
Run test with `ninja clang-format && bin/clang-format -style=google test.h`:
#include <util/bar/bar2.h> // bar2
#include <util/bar/bar2.h> /* bar2 */
#include <util/bar/bar3.h> // bar3
#include <util/bar/bar3.h> /* bar3 */
#include <util/foo/foo2.h> // foo2<T>
#include <util/foo/foo2.h> /* foo2<T> */
#include <util/foo/foo3.h> // foo3<T>
#include <util/foo/foo3.h> /* foo3<T> */
#include <cstdint>
#include "util/bar.h"
#include "util/bar/bar.h" // bar
#include "util/bar/bar.h" /* bar */
#include "util/foo/foo.h" // foo<T>
#include "util/foo/foo.h" /* foo<T> */
#include "utilzbar0.h" // bar0<T>
#include "utilzbar0.h" /* bar0<T> */
To me, this looks precisely how it should look like. What do you think?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121370/new/
https://reviews.llvm.org/D121370
More information about the cfe-commits
mailing list