[PATCH] D53882: [clang-tidy] Adding Zircon checker for std namespace

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 31 07:43:11 PDT 2018


aaron.ballman added a comment.

I am a bit confused by what this check is trying to accomplish. It seems like this is intended to catch use of anything declared within the standard library, but that includes library support things that are needed to write useful code. For instance, it seems this means users cannot use initializer lists or type traits. I'm not even certain users can overload `operator new()` because that uses `std::size_t` as an argument.

Can you expound on the requirements in a bit more detail? Is it truly "no standard library functionality at all, including things required to be supported in freestanding implementations"?



================
Comment at: clang-tools-extra/clang-tidy/zircon/NoStdNamespaceCheck.cpp:57-60
+  Finder->addMatcher(callExpr(callee(functionDecl(hasDeclContext(
+                                  namespaceDecl(isStdNamespace())))))
+                         .bind("stdCall"),
+                     this);
----------------
Is the intention here to diagnose code like this?
```
#include <cstdlib>

int main() {
  abort(); // Diagnose this?
}
```


https://reviews.llvm.org/D53882





More information about the cfe-commits mailing list