njames93 added inline comments.

================
Comment at: clang-tools-extra/clang-tidy/misc/AvoidStdIoOutsideMainCheck.cpp:22
+  Finder->addMatcher(
+      declRefExpr(to(varDecl(hasAnyName("cin", "wcin", "cout", "wcout", "cerr",
+                                        "wcerr"),
----------------
mgartmann wrote:
> Would there be a way to extract these names (`cin`, `cout`, ...) into a 
> separate variable? In my opinion, this would make the AST matchers cleaner 
> and easier to read.
> 
> E.g., I was not able to find an overload of `hasAnyName()` which takes a 
> `std:.vector` as argument.
> 
> Looking forward to hearing from you.
> Thanks for any feedback in advance.
`hasAnyName` can take an `ArrayRef<StringRef>` So If you have a 
`std::vector<StringRef>` that would work. If you have 
`std::vector<std::string>` you can still sort of use it
```lang=c++
  auto StringClassMatcher = cxxRecordDecl(hasAnyName(SmallVector<StringRef, 4>(
      StringLikeClasses.begin(), StringLikeClasses.end())));```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99646

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to