[PATCH] D99646: [clang-tidy] misc-std-stream-objects-outside-main: a new check

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 1 03:38:17 PDT 2021


riccibruno added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/StdStreamObjectsOutsideMainCheck.cpp:25
+          .bind("match"),
+      this);
+}
----------------
mgartmann wrote:
> mgartmann wrote:
> > riccibruno wrote:
> > > Will this match `my_namespace::cin`?
> > Yes, at the moment this would be matched as well.
> Thinking about it, in my opinion, only matching those objects if they are coming form the `std` namespace would make more sense and lead to less "false-positive" diagnostics. 
> Furthermore, [[ https://www.cevelop.com/ | Cevelop IDE ]]'s check, which is where the idea for this check came form, also behaves like this.
> 
> Thus, I added the `isInStdNamespace()` matcher in the latest diff.
> 
> @riccibruno What is your opinion on this? Would it make more sense to also match e.g., `my_namespace::cin` in your opinion? 
That was my point. I don't think that `my_namespace::cin` should be matched.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99646



More information about the cfe-commits mailing list