summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-12-16 10:10:16 +0000
committerDaniel Jasper <djasper@google.com>2015-12-16 10:10:16 +0000
commitd2629dc812a194cbe4cdfe7d7e5cc2c7ac53c73b (patch)
tree628ddfb0a53bb35ad46f09a55519addd16660fe3 /clang/lib
parente2222fdf953624761dd102ff6c9dd99ae7cb8066 (diff)
downloadbcm5719-llvm-d2629dc812a194cbe4cdfe7d7e5cc2c7ac53c73b.tar.gz
bcm5719-llvm-d2629dc812a194cbe4cdfe7d7e5cc2c7ac53c73b.zip
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
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/Format.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 896ecad60f5..a7e0799c119 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1684,7 +1684,7 @@ struct IncludeDirective {
StringRef Filename;
StringRef Text;
unsigned Offset;
- unsigned Category;
+ int Category;
};
} // end anonymous namespace
@@ -1807,11 +1807,11 @@ tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code,
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;
OpenPOWER on IntegriCloud