[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
Wed Mar 31 05:25:35 PDT 2021


riccibruno added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/StdStreamObjectsOutsideMainCheck.cpp:25
+          .bind("match"),
+      this);
+}
----------------
Will this match `my_namespace::cin`?


================
Comment at: clang-tools-extra/clang-tidy/misc/StdStreamObjectsOutsideMainCheck.cpp:47
+  if (AsFunctionDecl && AsFunctionDecl->getIdentifier() &&
+      AsFunctionDecl->getName().equals("main")) {
+    return true;
----------------
You can use `FunctionDecl::isMain`. Additionally you might want to also use `FunctionDecl::isMSVCRTEntryPoint` for the Windows-specific main functions.


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