[PATCH] D74669: [clang-tidy] New check: misc-no-include-cpp

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 23 07:54:47 PST 2020


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp:50-51
+
+  const char *const SuspiciousExtensions[] = {".c", ".cpp", ".cxx", ".cc"};
+  const char *const RecommendedExtensions[] = {"", ".h", ".hpp", ".hh"};
+
----------------
We already have `HeaderFileExtensionsUtils.h` -- we should be using that for the header file extensions (which should be configurable). 

It might make sense to make those utilities be general for other kinds of file extensions as well, such as source files. I think that list should also be configurable.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp:55
+    if (FileName.consume_back(SE)) {
+      Check.diag(DiagLoc, "suspicious #%0 of file with %1 extension")
+          << IncludeTok.getIdentifierInfo()->getName() << SE;
----------------
Should probably add `'` quotes around the extension to make it more obvious where the extension starts and stops.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74669/new/

https://reviews.llvm.org/D74669





More information about the cfe-commits mailing list