aaron.ballman added inline comments.

================
Comment at: clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp:64
 void StringConstructorCheck::registerMatchers(MatchFinder *Finder) {
+  const auto hasStringCtorName =
+      hasAnyNameStdString(removeNamespaces(StringNames));
----------------
You should fix the lint warning.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp:65
+  const auto hasStringCtorName =
+      hasAnyNameStdString(removeNamespaces(StringNames));
+
----------------
It took me a while to realize that this functionality is really about trying to 
get to the name of the constructor for a given type -- perhaps this should be a 
single function called `getCtorNameFromType()` or something?

Actually, given that this is a narrowing matcher from a `CXXConstructExpr`, 
can't you look at `CXXConstructExpr::getConstructor()` to get the 
`CXXConstructorDecl` and check the name from there? That seems cleaner than 
trying to identify the constructor name through string matching.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91015

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

Reply via email to