[PATCH] D129353: [clang-tidy] Improve check cert-dcl58-cpp.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 11 09:05:32 PDT 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM with some minor nits.



================
Comment at: clang-tools-extra/clang-tidy/cert/DontModifyStdNamespaceCheck.cpp:80-81
+  auto BadNonTemplateSpecializationDecl =
+      decl(unless(isExpansionInSystemHeader()),
+           unless(anyOf(functionDecl(isExplicitTemplateSpecialization()),
+                        varDecl(isExplicitTemplateSpecialization()),
----------------
This one can go as well, right?


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cert/dcl58-cpp.cpp:209
+
+using myint = int;
 
----------------
Can you add a comment above this to mention that an alias declaration is the same as a typedef, and does not introduce a user-defined type, which is why the below fails.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cert/dcl58-cpp.cpp:254
+
+namespace std {
+// CHECK-MESSAGES: :[[@LINE+3]]:8: warning: modification of 'std' namespace
----------------
Same mention here about an alias declaration not being a user-defined type.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129353



More information about the cfe-commits mailing list