[PATCH] D96744: clang-format IncludeBlocks: Regroup determination of "main" for framework-style includes fix

Conrad Poelman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 1 20:22:47 PDT 2023


poelmanc abandoned this revision.
poelmanc added a comment.
Herald added a project: All.

We eventually updated our coding standards and our fairly massive code base to change only the very top "main" include from `#include <path/to/Foo.h>` to `#include "Foo.h"`.

For all include statements after that, we still use framework-style includes (`#include <path/to/Bar.h>`).

It worked great and now we're happily using clang-format to order and group all our include statements, with no need for any changes to clang-format. Thanks to all for maintaining such an amazing tool!


Herald added a comment.

NOTE: Clang-Format Team Automated Review Comment

It looks like your clang-format review does not contain any unit tests, please try to ensure all code changes have a unit test (unless this is an `NFC` or refactoring, adding documentation etc..)

Add your unit tests in `clang/unittests/Format` and you can build with `ninja FormatTests`.  We recommend using the `verifyFormat(xxx)` format of unit tests rather than `EXPECT_EQ` as this will ensure you change is tolerant to random whitespace changes (see FormatTest.cpp as an example)

For situations where your change is altering the TokenAnnotator.cpp which can happen if you are trying to improve the annotation phase to ensure we are correctly identifying the type of a token, please add a token annotator test in `TokenAnnotatorTest.cpp`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96744



More information about the cfe-commits mailing list