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

Marco Gartmann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 1 03:17:05 PDT 2021


mgartmann added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/StdStreamObjectsOutsideMainCheck.cpp:25
+          .bind("match"),
+      this);
+}
----------------
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? 


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