[clang-tools-extra] r255243 - [clang-tidy] Sort includes case-sensitively.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 10 04:24:22 PST 2015


Author: alexfh
Date: Thu Dec 10 06:24:19 2015
New Revision: 255243

URL: http://llvm.org/viewvc/llvm-project?rev=255243&view=rev
Log:
[clang-tidy] Sort includes case-sensitively.

The motivation is:
  1. consistency with clang-format, vim :sort etc.
  2. we don't want the tools to depend on the current locale to do the include
     sorting

Modified:
    clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp

Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp?rev=255243&r1=255242&r2=255243&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp Thu Dec 10 06:24:19 2015
@@ -188,10 +188,7 @@ std::vector<FixItHint> IncludeSorter::Ge
   // delete inclusions.
   for (int IncludeKind = 0; IncludeKind < IK_InvalidInclude; ++IncludeKind) {
     std::sort(IncludeBucket[IncludeKind].begin(),
-              IncludeBucket[IncludeKind].end(),
-              [](const std::string &Left, const std::string &Right) {
-                return llvm::StringRef(Left).compare_lower(Right) < 0;
-              });
+              IncludeBucket[IncludeKind].end());
     for (const auto &IncludeEntry : IncludeBucket[IncludeKind]) {
       auto &Location = IncludeLocations[IncludeEntry];
       SourceRangeVector::iterator LocationIterator = Location.begin();




More information about the cfe-commits mailing list