clang-format: Extend header sort category implementation.
Specifically, it is sometimes necessary to keep certain #includes as
the first #include, even before the main #include for a .cc file.
Switching the category to be signed instead of unsigned isn't ideal,
but it seems as good of an option as any and is fully backwards
compatible.
llvm-svn: 255757
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 896ecad..a7e0799 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1684,7 +1684,7 @@
StringRef Filename;
StringRef Text;
unsigned Offset;
- unsigned Category;
+ int Category;
};
} // end anonymous namespace
@@ -1807,11 +1807,11 @@
if (!FormattingOff && !Line.endswith("\\")) {
if (IncludeRegex.match(Line, &Matches)) {
StringRef IncludeName = Matches[2];
- unsigned Category;
+ int Category;
if (LookForMainHeader && !IncludeName.startswith("<")) {
Category = 0;
} else {
- Category = UINT_MAX;
+ Category = INT_MAX;
for (unsigned i = 0, e = CategoryRegexs.size(); i != e; ++i) {
if (CategoryRegexs[i].match(IncludeName)) {
Category = Style.IncludeCategories[i].Priority;