[PATCH] D64695: [clang-format] Added new style rule: SortNetBSDIncludes

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 14 08:25:04 PDT 2019


MyDeveloperDay added a comment.

There also seems like alot of duplication between the existing sortCppIncludes

I think the only difference here is really just

  SmallVector<unsigned, 16> Indices;
    SmallVector<unsigned, 16> Includes_p;
    for (unsigned i = 0, e = Includes.size(); i != e; ++i) {
      unsigned pl = getNetBSDIncludePriority(Includes[i].Filename);
      Includes_p.push_back(pl);
      Indices.push_back(i);
    }

vs the original

  SmallVector<unsigned, 16> Indices;
  for (unsigned i = 0, e = Includes.size(); i != e; ++i)
    Indices.push_back(i);

plus way the sorting is performed, are we sure we couldn't have just made the original sorting more powerful based on style settings?



================
Comment at: lib/Format/Format.cpp:1878
+  SmallVector<unsigned, 16> Indices;
+  SmallVector<unsigned, 16> Includes_p;
+  for (unsigned i = 0, e = Includes.size(); i != e; ++i) {
----------------
_p? I don't understand what it stands for?

IncludesPriority?


Repository:
  rC Clang

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

https://reviews.llvm.org/D64695





More information about the cfe-commits mailing list