[PATCH] Add readability-duplicate-include check to clang-tidy

Samuel Benzaquen sbenza at google.com
Wed Mar 18 13:46:25 PDT 2015


================
Comment at: clang-tidy/readability/DuplicateIncludeCheck.cpp:23
@@ +22,3 @@
+
+SourceLocation AdvanceBeyondCurrentLine(SourceManager &SM, SourceLocation Start,
+                                        int Offset) {
----------------
Function names start with lowercase.

================
Comment at: clang-tidy/readability/DuplicateIncludeCheck.cpp:28
@@ +27,3 @@
+  while (SM.getFileID(Start) == Id &&
+         SM.getSpellingLineNumber(Start.getLocWithOffset(Offset)) ==
+             LineNumber) {
----------------
This seems very wasteful, given that the SourceManager could tell you (if there was an API) the location for the next line in O(1) time.
Don't know if it is worth enough to add this API to SourceManager.

================
Comment at: clang-tidy/readability/DuplicateIncludeCheck.cpp:53
@@ +52,3 @@
+private:
+  std::vector<StringRef> Files_;
+  DuplicateIncludeCheck &Check_;
----------------
These should not end with _

http://reviews.llvm.org/D7982

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list