================
Comment at: clang-tidy/readability/DuplicateIncludeCheck.cpp:62
@@ +61,3 @@
+    StringRef SearchPath, StringRef RelativePath, const Module *Imported) {
+  if (!SM_.isInMainFile(HashLoc)) {
+    return;
----------------
What's the reason to limit the check to the main file only? I think, it should 
work on all headers as well. Also, sometimes it's fine to have duplicate 
includes even without macro definitions in between, e.g. when these #includes 
are in different namespaces.

I'd suggest using the same technique as in the IncludeOrderCheck: for each file 
collect all preprocessor directives sorted by SourceLocation. Then detect 
#include blocks (not necessarily the same way as its done in the 
IncludeOrderCheck. Maybe use the presense of any non-comment tokens between 
#includes as a boundary of blocks), and detect duplicate includes in each block.

http://reviews.llvm.org/D7982

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



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to