[PATCH] D23421: [Clang-tidy] CERT-MSC53-CPP (checker for std namespace modification)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 12 03:20:20 PDT 2016
hokein added inline comments.
================
Comment at: clang-tidy/cert/DontModifyStdNamespaceCheck.cpp:20
@@ +19,3 @@
+
+void DontModifyStdNamespaceCheck::registerMatchers(MatchFinder *Finder) {
+ Finder->addMatcher(namespaceDecl(unless(isExpansionInSystemHeader()),
----------------
This check should be only available in cpp code.
```
if (!getLangOpts().CPlusPlus)
return;
```
================
Comment at: docs/clang-tidy/checks/cert-msc53-cpp.rst:4
@@ +3,3 @@
+cert-msc53-cpp
+==============================
+
----------------
`===` should be the same with `cert-msc53-cpp`.
================
Comment at: docs/clang-tidy/checks/cert-msc53-cpp.rst:6
@@ +5,2 @@
+
+Modification of the std or posix namespace can result to undefined behavior. This checker warns for such modifications.
----------------
Eugene.Zelenko wrote:
> Please highlight std and posix with ``.
Adding an example explaining the check would make the doc more clear. An example is worth a thousand words :)
================
Comment at: test/clang-tidy/cert-dont-modify-std-namespace.cpp:1
@@ +1,2 @@
+// RUN: %check_clang_tidy %s cert-msc53-cpp %t -- -- -std=c++1z
+
----------------
Do we need `c++1z` flag here?
Repository:
rL LLVM
https://reviews.llvm.org/D23421
More information about the cfe-commits
mailing list