[PATCH] D150187: [tidy][IdentifierNaming] Fix crashes on non-identifiers

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 9 02:49:56 PDT 2023


PiotrZSL accepted this revision.
PiotrZSL added a comment.
This revision is now accepted and ready to land.

LGTM, fell free to deliver (to quickly fix crash).
Any improvements could be done later.



================
Comment at: clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp:457
+  // Don't keep track for non-identifier names.
+  if (auto *II = Decl->getIdentifier()) {
+    return addUsage(RenamerClangTidyCheck::NamingCheckId(Decl->getLocation(),
----------------
Most probably this could be done before for, as overridden/cannonical decl should have same naming.
And looks we get here from VisitMemberExpr.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-nocrash.cpp:3-5
+struct Foo {
+  operator bool();
+};
----------------
i would merge this with some existing test file...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150187



More information about the cfe-commits mailing list