[PATCH] D151594: [clang-tidy] Optimize misc-confusable-identifiers

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 26 15:13:01 PDT 2023


PiotrZSL created this revision.
PiotrZSL added reviewers: serge-sans-paille, carlosgalvezp, njames93.
Herald added a subscriber: xazax.hun.
Herald added a project: All.
PiotrZSL requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

This is final optimization for this check. Main
improvements comes from changing a logic order
in mayShadow function, to first validate result
of mayShadowImpl, then search primary context in
a vectors. Secondary improvement comes from excluding
all implicit code by using TK_IgnoreUnlessSpelledInSource.
All other changes are just cosmetic improvements.

Tested on Cataclysm-DDA open source project, result in
check execution time reduction from 3682 seconds to
100 seconds (~0.25s per TU). That's 97.2% reduction for
this change alone. Resulting in cumulative improvement for
this check around -99.6%, finally bringing this check
into a cheap category.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151594

Files:
  clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.cpp
  clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151594.526206.patch
Type: text/x-patch
Size: 5179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230526/4f9a5b69/attachment.bin>


More information about the cfe-commits mailing list