This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Make clang-format and include-order-check coherent again
Needs ReviewPublic

Authored by njames93 on Dec 15 2020, 3:37 PM.

Details

Reviewers
hokein
kadircet
Summary

After D91602 gmock support was added to include-order check. However that support puts gmock and gtest headers in the same category as system headers.
ClangFormat on the other hand for LLVMStyle appears to put system headers after these 2 special cases.

This patch synchronizes the behaviour and fixes more false tidy-warnings

Diff Detail

Event Timeline

njames93 created this revision.Dec 15 2020, 3:37 PM
njames93 requested review of this revision.Dec 15 2020, 3:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 15 2020, 3:37 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

i thought clang-format was also putting angled includes and "OtherHeaders" into same category, by looking at:

LLVMStyle.IncludeStyle.IncludeCategories = {
      {"^\"(llvm|llvm-c|clang|clang-c)/", 2, 0, false},
      {"^(<|\"(gtest|gmock|isl|json)/)", 3, 0, false},      // Starts with `<` or gtest/gmock...
      {".*", 1, 0, false}};

not sure why it is done so (stylistic preferences i suppose ...). it definitely makes sense for me to separate them into 2 different categories, but i wouldn't dare make that decision :D maybe ask on cfe-dev first to get some consensus.
but it would make sense to include isl and json in this list for now, i forgot to do that in the initial patch :(