[PATCH] D23421: [Clang-tidy] CERT-DCL58-CPP (checker for std namespace modification)

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 15 05:48:12 PST 2017


aaron.ballman added inline comments.


================
Comment at: clang-tidy/cert/DontModifyStdNamespaceCheck.cpp:28
+          anyOf(hasName("std"), hasName("posix")),
+          has(decl(unless(cxxRecordDecl(isExplicitTemplateSpecialization())))))
+          .bind("nmspc"),
----------------
I think this is missing function declarations that are explicit template specializations as well (a common instance of this is specializing std::swap).


================
Comment at: test/clang-tidy/cert-dcl58-cpp.cpp:60
+}
+
+using namespace std;
----------------
I'd like to see a test where the user specializes a function template, like `swap()` to make sure we don't diagnose on that.


https://reviews.llvm.org/D23421





More information about the cfe-commits mailing list