[PATCH] [clang-tidy] Implement the include order checker for LLVM.
Alexander Kornienko
alexfh at google.com
Tue Aug 5 09:47:04 PDT 2014
Looks good provided the comments are addressed.
================
Comment at: clang-tidy/llvm/IncludeOrderCheck.cpp:71
@@ +70,3 @@
+/// \brief Find the offset of the next end of a line.
+static int findEndOfLine(const char *Text) {
+ return std::strcspn(Text, "\n");
----------------
Now that it is just one call, it's not particularly useful to have a separate function. Maybe inline it?
================
Comment at: clang-tidy/llvm/IncludeOrderCheck.cpp:103
@@ +102,3 @@
+ for (unsigned I = 1, E = IncludeDirectives.size(); I != E; ++I)
+ if (SM.getPresumedLineNumber(IncludeDirectives[I].Loc) !=
+ SM.getPresumedLineNumber(IncludeDirectives[I - 1].Loc) + 1)
----------------
It probably doesn't matter much, but I don't think we need presumed locations here. Considering #line directives doesn't make much sense in this context.
================
Comment at: clang-tidy/llvm/IncludeOrderCheck.cpp:142
@@ +141,3 @@
+ auto D =
+ Check.diag(IncludeDirectives[I].Loc, "#includes not sorted properly");
+
----------------
Maybe "#includes are not sorted properly"?
http://reviews.llvm.org/D4741
More information about the cfe-commits
mailing list