lebedev.ri added a comment.

`Libc` option name doesn't really make sense to me, maybe `FunctionSet` would 
fit better.



================
Comment at: clang-tools-extra/clang-tidy/misc/MtUnsafeCheck.cpp:32-33
+
+// Initial list was extracted from gcc documentation
+static const StringRef glibcFunctions[] = {
+    "::argp_error",
----------------
I would expect this can be outside of all the namespaces right after `using 
namespace clang::ast_matchers;`


================
Comment at: clang-tools-extra/clang-tidy/misc/MtUnsafeCheck.cpp:287-288
+
+static ast_matchers::internal::Matcher<clang::NamedDecl>
+hasAnyMtUnsafeNames(MtUnsafeCheck::LibcType libc) {
+  switch (libc) {
----------------
Likewise, i would expect this can be outside of namespaces


================
Comment at: clang-tools-extra/clang-tidy/misc/MtUnsafeCheck.cpp:295
+  case MtUnsafeCheck::LibcType::Any:
+    return hasAnyName(anyFunctions);
+  }
----------------
return anyOf(hasAnyName(posixFunctions), hasAnyName(glibcFunctions));


================
Comment at: clang-tools-extra/clang-tidy/misc/MtUnsafeCheck.cpp:309-310
+void MtUnsafeCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(callExpr(callee(functionDecl(hasAnyMtUnsafeNames(Libc))))
+                         .bind("mt-unsafe"),
+                     this);
----------------
Is there any way to invert the direction of this matcher,
instead of checking each call that it's callee isn't one of the bad ones,
look through all function decls, and for all the bad ones, diagnose all calls 
to them?


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:111
+
+  Finds thread-unsafe functions usage.
+
----------------
<...>, Currently knows about POSIX and GLIBC.

or something along those lines


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

https://reviews.llvm.org/D90944

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

Reply via email to